Retrieves a data table as a tidy dataframe using either an old-style CANSIM code or a new-format NDM table number. This function will automatically convert old-style CANSIM codes into their new equivalents. Retrieved table data is cached for the duration of the current R session only by default.

get_cansim(cansimTableNumber, language = "english", refresh = FALSE,
  timeout = 200)

Arguments

cansimTableNumber

the table number to load, accepts old CANSIM or new NDM table numbers

language

"en" or "english" for English and "fr" or "french" for French language versions (default is set to English)

refresh

(Optional) When set to TRUE, forces a reload of data table (default is FALSE)

timeout

(Optional) Timeout in seconds for downloading cansim table to work around scenarios where StatCan servers drop the network connection.

Value

tibble format data table output

Examples

# Retrieve a table with an NDM code get_cansim("34-10-0013")
#> Accessing CANSIM NDM product 34-10-0013 from Statistics Canada
#> Parsing data
#> Folding in metadata
#> # A tibble: 550 x 18 #> REF_DATE GEO DGUID `Type of proper… UOM UOM_ID SCALAR_FACTOR SCALAR_ID #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 2005 Cana… 2016… Residential Doll… 81 millions 6 #> 2 2005 Newf… 2016… Residential Doll… 81 millions 6 #> 3 2005 Prin… 2016… Residential Doll… 81 millions 6 #> 4 2005 Nova… 2016… Residential Doll… 81 millions 6 #> 5 2005 New … 2016… Residential Doll… 81 millions 6 #> 6 2005 Queb… 2016… Residential Doll… 81 millions 6 #> 7 2005 Onta… 2016… Residential Doll… 81 millions 6 #> 8 2005 Mani… 2016… Residential Doll… 81 millions 6 #> 9 2005 Sask… 2016… Residential Doll… 81 millions 6 #> 10 2005 Albe… 2016… Residential Doll… 81 millions 6 #> # … with 540 more rows, and 10 more variables: VECTOR <chr>, COORDINATE <chr>, #> # VALUE <dbl>, STATUS <chr>, SYMBOL <chr>, TERMINATED <chr>, DECIMALS <chr>, #> # GeoUID <chr>, `Classification Code for Type of property` <chr>, `Hierarchy #> # for Type of property` <chr>
# Retrieve a table with an old-style CANSIM code get_cansim("026-0018")
#> Legacy table number 026-0018, converting to NDM 34-10-0013
#> Reading CANSIM NDM product 34-10-0013 from cache.
#> # A tibble: 550 x 18 #> REF_DATE GEO DGUID `Type of proper… UOM UOM_ID SCALAR_FACTOR SCALAR_ID #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 2005 Cana… 2016… Residential Doll… 81 millions 6 #> 2 2005 Newf… 2016… Residential Doll… 81 millions 6 #> 3 2005 Prin… 2016… Residential Doll… 81 millions 6 #> 4 2005 Nova… 2016… Residential Doll… 81 millions 6 #> 5 2005 New … 2016… Residential Doll… 81 millions 6 #> 6 2005 Queb… 2016… Residential Doll… 81 millions 6 #> 7 2005 Onta… 2016… Residential Doll… 81 millions 6 #> 8 2005 Mani… 2016… Residential Doll… 81 millions 6 #> 9 2005 Sask… 2016… Residential Doll… 81 millions 6 #> 10 2005 Albe… 2016… Residential Doll… 81 millions 6 #> # … with 540 more rows, and 10 more variables: VECTOR <chr>, COORDINATE <chr>, #> # VALUE <dbl>, STATUS <chr>, SYMBOL <chr>, TERMINATED <chr>, DECIMALS <chr>, #> # GeoUID <chr>, `Classification Code for Type of property` <chr>, `Hierarchy #> # for Type of property` <chr>