Skip to contents

Convenience wrapper around the CRAN cansim package, which talks to the Statistics Canada NDM ("cansim") tabular data API. Use this for canonical CANSIM tables (e.g. "35-10-0177-01") rather than for PUMF _CSV.zip downloads — those go through morie_ingest_statcan_csv.

Usage

morie_ingest_statcan_cansim(
  table_id,
  language = c("eng", "fra"),
  refresh = FALSE,
  ...
)

Arguments

table_id

A StatCan / NDM table identifier, e.g. "35-10-0177" or "35-10-0177-01".

language

One of "eng" or "fra".

refresh

If TRUE, force cansim to re-download rather than using its on-disk cache.

...

Further arguments forwarded to get_cansim.

Value

A base R data.frame.

Details

If the STATCAN_API_KEY environment variable is set, it is passed to cansim::set_cansim_api_key() so authenticated rate limits apply.

Examples

if (FALSE) { # \dontrun{
# Requires the 'cansim' package and network access.
df <- morie_ingest_statcan_cansim("35-10-0177")
head(df)
} # }