From bb960a1645aa57a60e94b96b4ffe8ab50d9bf384 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Tue, 16 Sep 2025 10:48:06 -0700 Subject: [PATCH 01/59] better connection error handling --- DESCRIPTION | 2 +- R/cansim.R | 8 ++++++++ R/cansim_vectors.R | 14 ++++++++++++++ README.md | 4 ++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f6fd0b04..cb0e1cbf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: cansim Type: Package Title: Accessing Statistics Canada Data Table and Vectors -Version: 0.4.4 +Version: 0.4.5 Authors@R: c( person("Jens", "von Bergmann", email = "jens@mountainmath.ca", role = c("aut","cre")), person("Dmitry", "Shkolnik", email = "shkolnikd@gmail.com", role = c("aut"))) diff --git a/R/cansim.R b/R/cansim.R index fbef3204..aa6dac73 100644 --- a/R/cansim.R +++ b/R/cansim.R @@ -929,6 +929,10 @@ get_cansim_table_url <- function(cansimTableNumber, language = "en"){ l <- cleaned_ndm_language(language) %>% substr(1,2) url=paste0("https://www150.statcan.gc.ca/t1/wds/rest/getFullTableDownloadCSV/",naked_ndm_table_number(cansimTableNumber),"/",l) response <- httr::GET(url) + if (is.null(response)){return(response)} + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } @@ -976,6 +980,10 @@ get_cansim_changed_tables <- function(start_date,end_date=NULL){ lapply(function(date){ url=paste0("https://www150.statcan.gc.ca/t1/wds/rest/getChangedCubeList/",strftime(date,"%Y-%m-%d")) response <- httr::GET(url) + if (is.null(response)){return(response)} + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } diff --git a/R/cansim_vectors.R b/R/cansim_vectors.R index 4945d21c..0af34c30 100644 --- a/R/cansim_vectors.R +++ b/R/cansim_vectors.R @@ -207,6 +207,9 @@ get_cansim_vector<-function(vectors, start_time = as.Date("1800-01-01"), end_tim timeout = timeout) } if (is.null(response)) return(response) + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } @@ -317,6 +320,9 @@ get_cansim_vector_for_latest_periods<-function(vectors, periods=NULL, message(paste0("Accessing CANSIM NDM vectors from Statistics Canada",addition)) response <- post_with_timeout_retry(url, body=vectors_string, timeout = timeout) if (is.null(response)) return(response) + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } @@ -457,6 +463,10 @@ get_cansim_data_for_table_coord_periods<-function(tableCoordinates, periods=NULL } message(paste0("Accessing CANSIM NDM coordinates from Statistics Canada",addition)) response <- post_with_timeout_retry(url, body=body_string, timeout = timeout) + if (is.null(response)) {return(response)} + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } @@ -564,6 +574,10 @@ get_cansim_vector_info <- function(vectors){ url="https://www150.statcan.gc.ca/t1/wds/rest/getSeriesInfoFromVector" vectors_string=paste0("[",paste(purrr::map(as.character(vectors),function(x)paste0('{"vectorId":',x,'}')),collapse = ", "),"]") response <- post_with_timeout_retry(url, body=vectors_string) + if (is.null(response)){return(response)} + if (is.null(response$status_code)) { + stop("Problem downloading data.\n",response$error,call.=FALSE) + } if (response$status_code!=200) { stop("Problem downloading data, status code ",response$status_code,"\n",httr::content(response),call.=FALSE) } diff --git a/README.md b/README.md index 0e73634b..70008548 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ If you want to get in touch, we are pretty good at responding via email or via t If you wish to cite the `cansim` package in your work: - von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.4. DOI: 10.32614/CRAN.package.cansim + von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.5. DOI: 10.32614/CRAN.package.cansim A BibTeX entry for LaTeX users is @@ -241,7 +241,7 @@ A BibTeX entry for LaTeX users is title = {cansim: functions and convenience tools for accessing Statistics Canada data tables}, year = {2025}, doi = {10.32614/CRAN.package.cansim}, - note = {R package version 0.4.4}, + note = {R package version 0.4.5}, url = {https://mountainmath.github.io/cansim/} } ``` From 1bef2594dae4aace32bc919f53e8d0b61cee6c46 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Tue, 16 Sep 2025 10:48:53 -0700 Subject: [PATCH 02/59] new and cran comments --- NEWS.md | 4 ++++ cran-comments.md | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/NEWS.md b/NEWS.md index b312c8b1..176e2b9d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# cansim 0.4.5 +## Minor changes +* better connection error handling + # cansim 0.4.4 ## Minor changes * fix a problem with metadata parsing does not work properly for table names diff --git a/cran-comments.md b/cran-comments.md index 56481467..6b59b4a9 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -151,3 +151,8 @@ There were no ERRORs or WARNINGs or NOTEs. * fix a problem with metadata parsing does not work properly for table names * make documentations more consistent wrt default langauge names * add convenience functions for setting cache paths for data accessed via get_cansim_connection + +# cansim 0.4.5 +## Minor changes +* better connection error handling + From adb42bc83bc15d974a21c132986965d2e97a12e0 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 08:18:38 -0800 Subject: [PATCH 03/59] more improvements on error handling --- R/cansim_helpers.R | 4 ++++ R/cansim_tables_list.R | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/R/cansim_helpers.R b/R/cansim_helpers.R index 2a433aa9..0282dc62 100644 --- a/R/cansim_helpers.R +++ b/R/cansim_helpers.R @@ -279,6 +279,10 @@ get_cansim_code_set <- function(code_set=c("scalar", "frequency", "symbol", "sta if (refresh | !file.exists(path)) { url='https://www150.statcan.gc.ca/t1/wds/rest/getCodeSets' r<-get_with_timeout_retry(url) + if (is.null(r)||is.null(r$status_code)){ + warning("Problem downloading code sets.") + return(NULL) + } if (r$status_code==200) { content <- httr::content(r) saveRDS(content,path) diff --git a/R/cansim_tables_list.R b/R/cansim_tables_list.R index 9c184a82..66ac7835 100644 --- a/R/cansim_tables_list.R +++ b/R/cansim_tables_list.R @@ -89,6 +89,10 @@ list_cansim_cubes <- function(lite=FALSE,refresh=FALSE,quiet=FALSE){ if (!quiet) message("Retrieving cube information from StatCan servers...") url=ifelse(lite,"https://www150.statcan.gc.ca/t1/wds/rest/getAllCubesListLite","https://www150.statcan.gc.ca/t1/wds/rest/getAllCubesList") r<-get_with_timeout_retry(url,retry=0,warn_only=TRUE) + if (is.null(r)||is.null(r$status_code)){ + warning("Could not retrieve cube list from StatCan servers.") + return(NULL) + } if (r$status_code==200) { content <- httr::content(r) From 1288fb1c8ed32a5bb5f719e0a52c8fc88adc451f Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 08:45:03 -0800 Subject: [PATCH 04/59] fail more gracefully when statcan servers are down and cube list can't be accessed --- R/cansim_tables_list.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/cansim_tables_list.R b/R/cansim_tables_list.R index 66ac7835..24fb237c 100644 --- a/R/cansim_tables_list.R +++ b/R/cansim_tables_list.R @@ -177,7 +177,11 @@ list_cansim_cubes <- function(lite=FALSE,refresh=FALSE,quiet=FALSE){ #' #' @export search_cansim_cubes <- function(search_term, refresh=FALSE){ - list_cansim_cubes(refresh = refresh) %>% + cube_list <- list_cansim_cubes(refresh = refresh) + if (is.null(cube_list)) { + stop("Could not retrieve cube list from StatCan servers.",call.=FALSE) + } + cube_list %>% filter(grepl(search_term,.data$cubeTitleEn,ignore.case = TRUE) | grepl(search_term,.data$cubeTitleFr,ignore.case = TRUE) | grepl(search_term,.data$surveyEn,ignore.case = TRUE) | From 6eeb3d4156589befd61e42a6d693c1293815c95c Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 09:23:26 -0800 Subject: [PATCH 05/59] tidyselect tweaks --- R/cansim_vectors.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cansim_vectors.R b/R/cansim_vectors.R index 0af34c30..eb2a534b 100644 --- a/R/cansim_vectors.R +++ b/R/cansim_vectors.R @@ -417,7 +417,7 @@ get_cansim_data_for_table_coord_periods<-function(tableCoordinates, periods=NULL if ("list" %in% class(tableCoordinates)) { tableCoordinates <- tibble::enframe(tableCoordinates) %>% setNames(c("cansimTableNumber","COORDINATE")) %>% - tidyr::unnest_longer(.data$COORDINATE) + tidyr::unnest_longer("COORDINATE") } tableCoordinates <- tableCoordinates %>% mutate(cansimTableNumber=naked_ndm_table_number(.data$cansimTableNumber)) %>% From 99a4db3c281eeb1044e826249a47d6cf6c96066b Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 11:06:50 -0800 Subject: [PATCH 06/59] fix doi badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70008548..56637364 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![CRAN status](https://www.r-pkg.org/badges/version/cansim)](https://CRAN.R-project.org/package=cansim) [![CRAN_Downloads_Badge](https://cranlogs.r-pkg.org/badges/cansim)](https://cranlogs.r-pkg.org/badges/cansim) [![R-CMD-check](https://github.com/mountainMath/cansim/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mountainMath/cansim/actions/workflows/R-CMD-check.yaml) -[![DOI](https://img.shields.io/badge/doi-10.32614/CRAN.package.cansim-#d2b24a.svg)](https://doi.org/10.32614/CRAN.package.cansim) +[![DOI](https://img.shields.io/badge/doi-10.32614-d2b24a.svg](https://doi.org/10.32614/CRAN.package.cansim) cansim logo From 6cf8f57ad8aa32209f64d99e9f7266569424806b Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 11:11:41 -0800 Subject: [PATCH 07/59] fix dio badge --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56637364..465fd4e6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![CRAN status](https://www.r-pkg.org/badges/version/cansim)](https://CRAN.R-project.org/package=cansim) [![CRAN_Downloads_Badge](https://cranlogs.r-pkg.org/badges/cansim)](https://cranlogs.r-pkg.org/badges/cansim) [![R-CMD-check](https://github.com/mountainMath/cansim/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mountainMath/cansim/actions/workflows/R-CMD-check.yaml) -[![DOI](https://img.shields.io/badge/doi-10.32614-d2b24a.svg](https://doi.org/10.32614/CRAN.package.cansim) +[![DOI](https://img.shields.io/badge/ DOI-10.32614/CRAN.package.cansim-d2b24a.svg)](https://doi.org/10.32614/CRAN.package.cansim) cansim logo @@ -231,7 +231,7 @@ If you want to get in touch, we are pretty good at responding via email or via t If you wish to cite the `cansim` package in your work: - von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.5. DOI: 10.32614/CRAN.package.cansim + von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.4. DOI: 10.32614/CRAN.package.cansim A BibTeX entry for LaTeX users is @@ -241,7 +241,7 @@ A BibTeX entry for LaTeX users is title = {cansim: functions and convenience tools for accessing Statistics Canada data tables}, year = {2025}, doi = {10.32614/CRAN.package.cansim}, - note = {R package version 0.4.5}, + note = {R package version 0.4.4}, url = {https://mountainmath.github.io/cansim/} } ``` From e3b4e4bdd37adc02aad696ab759c02d1940e65c0 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Sat, 15 Nov 2025 11:24:25 -0800 Subject: [PATCH 08/59] toggle visibility of main logo on pkgdown site --- README.md | 7 +- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/LICENSE.html | 2 +- docs/articles/cansim.html | 2 +- docs/articles/index.html | 2 +- docs/articles/listing_cansim_tables.html | 2 +- .../figure-html/unnamed-chunk-4-1.png | Bin 157608 -> 157621 bytes .../articles/partial_table_data_download.html | 2 +- docs/articles/retrieving_cansim_vectors.html | 30 +++--- .../figure-html/unnamed-chunk-4-1.png | Bin 89244 -> 89360 bytes docs/articles/working_with_hierarchies.html | 4 +- docs/articles/working_with_large_tables.html | 86 +++++++++--------- .../figure-html/unnamed-chunk-10-1.png | Bin 98839 -> 98844 bytes docs/authors.html | 2 +- docs/index.html | 17 ++-- docs/news/index.html | 11 ++- docs/pkgdown.yml | 4 +- .../add_cansim_vectors_to_template.html | 4 +- .../add_provincial_abbreviations.html | 2 +- docs/reference/cansim_old_to_new.html | 2 +- .../cansim_repartition_cached_table.html | 2 +- docs/reference/categories_for_level.html | 2 +- docs/reference/collect_and_normalize.html | 2 +- docs/reference/correspondence.html | 2 +- docs/reference/create_index.html | 2 +- docs/reference/csv2arrow.html | 2 +- docs/reference/csv2sqlite.html | 2 +- docs/reference/disconnect_cansim_sqlite.html | 2 +- .../fold_in_metadata_for_columns.html | 2 +- docs/reference/get_cansim.html | 2 +- docs/reference/get_cansim_changed_tables.html | 2 +- docs/reference/get_cansim_code_set.html | 2 +- .../get_cansim_column_categories.html | 2 +- docs/reference/get_cansim_column_list.html | 2 +- docs/reference/get_cansim_connection.html | 2 +- docs/reference/get_cansim_cube_metadata.html | 2 +- ...t_cansim_data_for_table_coord_periods.html | 2 +- .../get_cansim_key_release_schedule.html | 2 +- .../get_cansim_series_info_cube_coord.html | 2 +- docs/reference/get_cansim_sqlite.html | 2 +- docs/reference/get_cansim_table_info.html | 2 +- .../get_cansim_table_last_release_date.html | 2 +- docs/reference/get_cansim_table_notes.html | 2 +- docs/reference/get_cansim_table_overview.html | 2 +- .../get_cansim_table_short_notes.html | 2 +- docs/reference/get_cansim_table_subject.html | 2 +- docs/reference/get_cansim_table_survey.html | 2 +- docs/reference/get_cansim_table_template.html | 2 +- docs/reference/get_cansim_table_url.html | 2 +- docs/reference/get_cansim_vector.html | 2 +- .../get_cansim_vector_for_latest_periods.html | 2 +- docs/reference/get_cansim_vector_info.html | 2 +- .../get_deduped_column_level_data.html | 2 +- docs/reference/index.html | 2 +- docs/reference/list_cansim_cached_tables.html | 2 +- docs/reference/list_cansim_cubes.html | 2 +- .../list_cansim_sqlite_cached_tables.html | 2 +- docs/reference/list_cansim_tables.html | 2 +- docs/reference/normalize_cansim_values.html | 2 +- docs/reference/parse_metadata.html | 2 +- .../remove_cansim_cached_tables.html | 2 +- .../remove_cansim_sqlite_cached_table.html | 2 +- docs/reference/search_cansim_cubes.html | 2 +- docs/reference/search_cansim_tables.html | 2 +- docs/reference/set_cansim_cache_path.html | 2 +- docs/reference/show_cansim_cache_path.html | 5 +- docs/reference/view_cansim_webpage.html | 2 +- docs/search.json | 2 +- 69 files changed, 148 insertions(+), 134 deletions(-) diff --git a/README.md b/README.md index 465fd4e6..a03f0625 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,12 @@ [![DOI](https://img.shields.io/badge/ DOI-10.32614/CRAN.package.cansim-d2b24a.svg)](https://doi.org/10.32614/CRAN.package.cansim) -cansim logo + + An R package to retrieve and work with public Statistics Canada data tables. diff --git a/docs/404.html b/docs/404.html index c73f2820..d0ec05d7 100644 --- a/docs/404.html +++ b/docs/404.html @@ -38,7 +38,7 @@ cansim - 0.4.4 + 0.4.5 + + + + + +
+
+
+ +
+

Closes the database connection behind a table retrieved with +get_cansim_connection(..., format="sqlite"). Parquet and feather connections hold no +connection to close and are left alone, so code that does not know which format it was handed +can close it either way.

+
+ +
+

Usage

+
disconnect_cansim_connection(connection)
+
+ +
+

Arguments

+ + +
connection
+

A connection to a cansim table as returned by get_cansim_connection

+ +
+
+

Value

+

`NULL`

+
+ +
+

Examples

+
if (FALSE) { # \dontrun{
+con <- get_cansim_connection("34-10-0013", format="sqlite")
+disconnect_cansim_connection(con)
+} # }
+
+
+
+ + +
+ + + + + + + diff --git a/docs/reference/disconnect_cansim_connection.md b/docs/reference/disconnect_cansim_connection.md new file mode 100644 index 00000000..86fa9e39 --- /dev/null +++ b/docs/reference/disconnect_cansim_connection.md @@ -0,0 +1,31 @@ +# Disconnect from a cansim connection + +Closes the database connection behind a table retrieved with +`get_cansim_connection(..., format="sqlite")`. Parquet and feather +connections hold no connection to close and are left alone, so code that +does not know which format it was handed can close it either way. + +## Usage + +``` r +disconnect_cansim_connection(connection) +``` + +## Arguments + +- connection: + + A connection to a cansim table as returned by `get_cansim_connection` + +## Value + +\`NULL\` + +## Examples + +``` r +if (FALSE) { # \dontrun{ +con <- get_cansim_connection("34-10-0013", format="sqlite") +disconnect_cansim_connection(con) +} # } +``` diff --git a/docs/reference/disconnect_cansim_sqlite.html b/docs/reference/disconnect_cansim_sqlite.html index d3a5cd7e..468478b7 100644 --- a/docs/reference/disconnect_cansim_sqlite.html +++ b/docs/reference/disconnect_cansim_sqlite.html @@ -1,5 +1,7 @@ -Disconnect from a cansim database connection — disconnect_cansim_sqlite • cansim + Skip to contents + + +
+
+
+ +
+

Retrieve the data points Statistics Canada changed for the given coordinates of a table. +Coordinates among the ones asked about that did not change contribute no rows, and if none of them +changed the result is an empty table rather than an error. The StatCan API can only process 300 +coordinates at a time, if more than 300 coordinates are specified the function will batch the +requests to the API.

+
+ +
+

Usage

+
get_cansim_changed_series_data_for_coordinates(
+  cansimTableNumber,
+  coordinates,
+  language = "english",
+  timeout = 200,
+  factors = TRUE,
+  default_month = "07",
+  default_day = "01"
+)
+
+ +
+

Arguments

+ + +
cansimTableNumber
+

The table number the coordinates belong to

+ + +
coordinates
+

The coordinates to retrieve changed data for

+ + +
language
+

"english" (the default) or "french". Short forms such as "en", "eng", "fr" or "fra" are accepted, as are the French names "anglais" and "francais"; case and accents are ignored

+ + +
timeout
+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

+ + +
factors
+

(Optional) Logical value indicating if dimensions should be converted to factors. (Default set to TRUE).

+ + +
default_month
+

The default month that should be used when creating Date objects for annual data (default set to "07")

+ + +
default_day
+

The default day of the month that should be used when creating Date objects for monthly data (default set to "01")

+ +
+
+

Value

+

A tibble with the changed data for the specified coordinates

+

Returns NULL if the data could not be retrieved because StatCan is unavailable.

+
+ +
+

Examples

+
if (FALSE) { # \dontrun{
+get_cansim_changed_series_data_for_coordinates("34-10-0013","1.1")
+} # }
+
+
+
+ + +
+ + + + + + + diff --git a/docs/reference/get_cansim_changed_series_data_for_coordinates.md b/docs/reference/get_cansim_changed_series_data_for_coordinates.md new file mode 100644 index 00000000..f448d7fd --- /dev/null +++ b/docs/reference/get_cansim_changed_series_data_for_coordinates.md @@ -0,0 +1,79 @@ +# Retrieve data for series that changed, by table and coordinate + +Retrieve the data points Statistics Canada changed for the given +coordinates of a table. Coordinates among the ones asked about that did +not change contribute no rows, and if none of them changed the result is +an empty table rather than an error. The StatCan API can only process +300 coordinates at a time, if more than 300 coordinates are specified +the function will batch the requests to the API. + +## Usage + +``` r +get_cansim_changed_series_data_for_coordinates( + cansimTableNumber, + coordinates, + language = "english", + timeout = 200, + factors = TRUE, + default_month = "07", + default_day = "01" +) +``` + +## Arguments + +- cansimTableNumber: + + The table number the coordinates belong to + +- coordinates: + + The coordinates to retrieve changed data for + +- language: + + `"english"` (the default) or `"french"`. Short forms such as `"en"`, + `"eng"`, `"fr"` or `"fra"` are accepted, as are the French names + `"anglais"` and `"francais"`; case and accents are ignored + +- timeout: + + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. + +- factors: + + (Optional) Logical value indicating if dimensions should be converted + to factors. (Default set to `TRUE`). + +- default_month: + + The default month that should be used when creating Date objects for + annual data (default set to "07") + +- default_day: + + The default day of the month that should be used when creating Date + objects for monthly data (default set to "01") + +## Value + +A tibble with the changed data for the specified coordinates + +Returns `NULL` if the data could not be retrieved because StatCan is +unavailable. + +## Examples + +``` r +if (FALSE) { # \dontrun{ +get_cansim_changed_series_data_for_coordinates("34-10-0013","1.1") +} # } +``` diff --git a/docs/reference/get_cansim_changed_series_data_for_vectors.html b/docs/reference/get_cansim_changed_series_data_for_vectors.html new file mode 100644 index 00000000..b1775d63 --- /dev/null +++ b/docs/reference/get_cansim_changed_series_data_for_vectors.html @@ -0,0 +1,149 @@ + +Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors • cansim + Skip to contents + + +
+
+
+ +
+

Retrieve the data points Statistics Canada changed for the given vectors. Series among the ones +asked about that did not change contribute no rows, and if none of them changed the result is an +empty table rather than an error. The StatCan API can only process 300 vectors at a time, if more +than 300 vectors are specified the function will batch the requests to the API.

+
+ +
+

Usage

+
get_cansim_changed_series_data_for_vectors(
+  vectors,
+  language = "english",
+  timeout = 200,
+  factors = TRUE,
+  default_month = "07",
+  default_day = "01"
+)
+
+ +
+

Arguments

+ + +
vectors
+

The list of vectors to retrieve changed data for

+ + +
language
+

"english" (the default) or "french". Short forms such as "en", "eng", "fr" or "fra" are accepted, as are the French names "anglais" and "francais"; case and accents are ignored

+ + +
timeout
+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

+ + +
factors
+

(Optional) Logical value indicating if dimensions should be converted to factors. (Default set to TRUE).

+ + +
default_month
+

The default month that should be used when creating Date objects for annual data (default set to "07")

+ + +
default_day
+

The default day of the month that should be used when creating Date objects for monthly data (default set to "01")

+ +
+
+

Value

+

A tibble with the changed data for the specified vector(s)

+

Returns NULL if the data could not be retrieved because StatCan is unavailable.

+
+ +
+

Examples

+
if (FALSE) { # \dontrun{
+get_cansim_changed_series_data_for_vectors("v41690973")
+} # }
+
+
+
+ + +
+ + + + + + + diff --git a/docs/reference/get_cansim_changed_series_data_for_vectors.md b/docs/reference/get_cansim_changed_series_data_for_vectors.md new file mode 100644 index 00000000..b4216ec8 --- /dev/null +++ b/docs/reference/get_cansim_changed_series_data_for_vectors.md @@ -0,0 +1,74 @@ +# Retrieve data for series that changed, by vector + +Retrieve the data points Statistics Canada changed for the given +vectors. Series among the ones asked about that did not change +contribute no rows, and if none of them changed the result is an empty +table rather than an error. The StatCan API can only process 300 vectors +at a time, if more than 300 vectors are specified the function will +batch the requests to the API. + +## Usage + +``` r +get_cansim_changed_series_data_for_vectors( + vectors, + language = "english", + timeout = 200, + factors = TRUE, + default_month = "07", + default_day = "01" +) +``` + +## Arguments + +- vectors: + + The list of vectors to retrieve changed data for + +- language: + + `"english"` (the default) or `"french"`. Short forms such as `"en"`, + `"eng"`, `"fr"` or `"fra"` are accepted, as are the French names + `"anglais"` and `"francais"`; case and accents are ignored + +- timeout: + + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. + +- factors: + + (Optional) Logical value indicating if dimensions should be converted + to factors. (Default set to `TRUE`). + +- default_month: + + The default month that should be used when creating Date objects for + annual data (default set to "07") + +- default_day: + + The default day of the month that should be used when creating Date + objects for monthly data (default set to "01") + +## Value + +A tibble with the changed data for the specified vector(s) + +Returns `NULL` if the data could not be retrieved because StatCan is +unavailable. + +## Examples + +``` r +if (FALSE) { # \dontrun{ +get_cansim_changed_series_data_for_vectors("v41690973") +} # } +``` diff --git a/docs/reference/get_cansim_column_categories.html b/docs/reference/get_cansim_column_categories.html index 4266f09e..a3e94eb3 100644 --- a/docs/reference/get_cansim_column_categories.html +++ b/docs/reference/get_cansim_column_categories.html @@ -97,7 +97,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_column_categories.md b/docs/reference/get_cansim_column_categories.md index 0b0ec855..d85c781b 100644 --- a/docs/reference/get_cansim_column_categories.md +++ b/docs/reference/get_cansim_column_categories.md @@ -39,8 +39,14 @@ get_cansim_column_categories( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_column_list.html b/docs/reference/get_cansim_column_list.html index e68ef275..576202f0 100644 --- a/docs/reference/get_cansim_column_list.html +++ b/docs/reference/get_cansim_column_list.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_column_list.md b/docs/reference/get_cansim_column_list.md index ec57ba5a..a879275b 100644 --- a/docs/reference/get_cansim_column_list.md +++ b/docs/reference/get_cansim_column_list.md @@ -34,8 +34,14 @@ get_cansim_column_list( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_connection.html b/docs/reference/get_cansim_connection.html index 79597e95..3db5f000 100644 --- a/docs/reference/get_cansim_connection.html +++ b/docs/reference/get_cansim_connection.html @@ -115,7 +115,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

cache_path
diff --git a/docs/reference/get_cansim_connection.md b/docs/reference/get_cansim_connection.md index a3d5023c..a05ba8ae 100644 --- a/docs/reference/get_cansim_connection.md +++ b/docs/reference/get_cansim_connection.md @@ -53,8 +53,14 @@ get_cansim_connection( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. - cache_path: diff --git a/docs/reference/get_cansim_data_for_table_coord_periods.html b/docs/reference/get_cansim_data_for_table_coord_periods.html index 582459f1..c136e01b 100644 --- a/docs/reference/get_cansim_data_for_table_coord_periods.html +++ b/docs/reference/get_cansim_data_for_table_coord_periods.html @@ -115,7 +115,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

factors
diff --git a/docs/reference/get_cansim_data_for_table_coord_periods.md b/docs/reference/get_cansim_data_for_table_coord_periods.md index d2603a61..2df7ad5a 100644 --- a/docs/reference/get_cansim_data_for_table_coord_periods.md +++ b/docs/reference/get_cansim_data_for_table_coord_periods.md @@ -51,8 +51,14 @@ get_cansim_data_for_table_coord_periods( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. - factors: diff --git a/docs/reference/get_cansim_series_info_cube_coord.html b/docs/reference/get_cansim_series_info_cube_coord.html index fe48347e..a3c45775 100644 --- a/docs/reference/get_cansim_series_info_cube_coord.html +++ b/docs/reference/get_cansim_series_info_cube_coord.html @@ -88,7 +88,7 @@

Argumentstimeout -

Timeout for the API call

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the call is abandoned. This does not limit how long the call may take overall, a response that keeps arriving is left alone.

refresh
@@ -105,8 +105,7 @@

Value

Examples

# \donttest{
 get_cansim_series_info_cube_coord("34-10-0013", c("1.1.1.1.1.1", "2.1.1.1.1.1"))
-#> # A tibble: 0 × 3
-#> # ℹ 3 variables: productId <int>, coordinate <chr>, vectorId <int>
+#> # A tibble: 0 × 0
 # }
 
diff --git a/docs/reference/get_cansim_series_info_cube_coord.md b/docs/reference/get_cansim_series_info_cube_coord.md index 75bb10dc..c515ce70 100644 --- a/docs/reference/get_cansim_series_info_cube_coord.md +++ b/docs/reference/get_cansim_series_info_cube_coord.md @@ -26,7 +26,9 @@ get_cansim_series_info_cube_coord( - timeout: - Timeout for the API call + (Optional) Number of seconds StatCan is allowed to go without sending + data before the call is abandoned. This does not limit how long the + call may take overall, a response that keeps arriving is left alone. - refresh: @@ -44,7 +46,6 @@ unavailable. ``` r # \donttest{ get_cansim_series_info_cube_coord("34-10-0013", c("1.1.1.1.1.1", "2.1.1.1.1.1")) -#> # A tibble: 0 × 3 -#> # ℹ 3 variables: productId , coordinate , vectorId +#> # A tibble: 0 × 0 # } ``` diff --git a/docs/reference/get_cansim_sqlite.html b/docs/reference/get_cansim_sqlite.html index 055f9f6e..24029ded 100644 --- a/docs/reference/get_cansim_sqlite.html +++ b/docs/reference/get_cansim_sqlite.html @@ -113,7 +113,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

cache_path
@@ -135,7 +135,7 @@

Examples# Work with the data connection glimpse(con) -disconnect_cansim_sqlite(con) +disconnect_cansim_connection(con) } # } diff --git a/docs/reference/get_cansim_sqlite.md b/docs/reference/get_cansim_sqlite.md index 49108843..5152b5c1 100644 --- a/docs/reference/get_cansim_sqlite.md +++ b/docs/reference/get_cansim_sqlite.md @@ -45,8 +45,14 @@ get_cansim_sqlite( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. - cache_path: @@ -72,6 +78,6 @@ con <- get_cansim_connection("34-10-0013", format="sqlite") # Work with the data connection glimpse(con) -disconnect_cansim_sqlite(con) +disconnect_cansim_connection(con) } # } ``` diff --git a/docs/reference/get_cansim_table_info.html b/docs/reference/get_cansim_table_info.html index adfb645a..323da2ed 100644 --- a/docs/reference/get_cansim_table_info.html +++ b/docs/reference/get_cansim_table_info.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_table_info.md b/docs/reference/get_cansim_table_info.md index f39e84dc..cd0b5107 100644 --- a/docs/reference/get_cansim_table_info.md +++ b/docs/reference/get_cansim_table_info.md @@ -34,8 +34,14 @@ get_cansim_table_info( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_table_notes.html b/docs/reference/get_cansim_table_notes.html index c8ce8b2e..304d7e18 100644 --- a/docs/reference/get_cansim_table_notes.html +++ b/docs/reference/get_cansim_table_notes.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_table_notes.md b/docs/reference/get_cansim_table_notes.md index 2982cb24..cd181789 100644 --- a/docs/reference/get_cansim_table_notes.md +++ b/docs/reference/get_cansim_table_notes.md @@ -34,8 +34,14 @@ get_cansim_table_notes( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_table_short_notes.html b/docs/reference/get_cansim_table_short_notes.html index 566d50aa..5687f3ae 100644 --- a/docs/reference/get_cansim_table_short_notes.html +++ b/docs/reference/get_cansim_table_short_notes.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_table_short_notes.md b/docs/reference/get_cansim_table_short_notes.md index df628db6..db296c7b 100644 --- a/docs/reference/get_cansim_table_short_notes.md +++ b/docs/reference/get_cansim_table_short_notes.md @@ -34,8 +34,14 @@ get_cansim_table_short_notes( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_table_subject.html b/docs/reference/get_cansim_table_subject.html index 487b38a6..14f56c7b 100644 --- a/docs/reference/get_cansim_table_subject.html +++ b/docs/reference/get_cansim_table_subject.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_table_subject.md b/docs/reference/get_cansim_table_subject.md index 37e7bd76..f232a6f8 100644 --- a/docs/reference/get_cansim_table_subject.md +++ b/docs/reference/get_cansim_table_subject.md @@ -34,8 +34,14 @@ get_cansim_table_subject( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_table_survey.html b/docs/reference/get_cansim_table_survey.html index 2cfe05bf..69248eb7 100644 --- a/docs/reference/get_cansim_table_survey.html +++ b/docs/reference/get_cansim_table_survey.html @@ -92,7 +92,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

diff --git a/docs/reference/get_cansim_table_survey.md b/docs/reference/get_cansim_table_survey.md index 1622c01e..da6903ff 100644 --- a/docs/reference/get_cansim_table_survey.md +++ b/docs/reference/get_cansim_table_survey.md @@ -34,8 +34,14 @@ get_cansim_table_survey( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. ## Value diff --git a/docs/reference/get_cansim_vector.html b/docs/reference/get_cansim_vector.html index 193fe8d9..6c14b9dd 100644 --- a/docs/reference/get_cansim_vector.html +++ b/docs/reference/get_cansim_vector.html @@ -128,7 +128,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

factors
@@ -154,7 +154,7 @@

Examples
# \donttest{
 get_cansim_vector("v41690973","2015-01-01")
 #> Accessing CANSIM NDM vectors from Statistics Canada
-#> # A tibble: 138 × 16
+#> # A tibble: 139 × 16
 #>    REF_DATE  Date       GEO   Products and product…¹ VALUE val_norm UOM   UOM_ID
 #>    <chr>     <date>     <fct> <fct>                  <dbl>    <dbl> <chr> <chr> 
 #>  1 2015-01-… 2015-01-01 Cana… All-items               124.     124. 2002… 17    
@@ -167,7 +167,7 @@ 

Examples#> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 -#> # ℹ 128 more rows +#> # ℹ 129 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID <int>, VECTOR <chr>, cansimTableNumber <chr>, #> # COORDINATE <chr>, SYMBOL <int>, releaseTime <chr>, frequencyCode <int>, diff --git a/docs/reference/get_cansim_vector.md b/docs/reference/get_cansim_vector.md index 2084c77a..50de98d8 100644 --- a/docs/reference/get_cansim_vector.md +++ b/docs/reference/get_cansim_vector.md @@ -62,8 +62,14 @@ get_cansim_vector( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. - factors: @@ -93,7 +99,7 @@ unavailable. # \donttest{ get_cansim_vector("v41690973","2015-01-01") #> Accessing CANSIM NDM vectors from Statistics Canada -#> # A tibble: 138 × 16 +#> # A tibble: 139 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2015-01-… 2015-01-01 Cana… All-items 124. 124. 2002… 17 @@ -106,7 +112,7 @@ get_cansim_vector("v41690973","2015-01-01") #> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 -#> # ℹ 128 more rows +#> # ℹ 129 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , diff --git a/docs/reference/get_cansim_vector_for_latest_periods.html b/docs/reference/get_cansim_vector_for_latest_periods.html index e0a06bfb..ff348738 100644 --- a/docs/reference/get_cansim_vector_for_latest_periods.html +++ b/docs/reference/get_cansim_vector_for_latest_periods.html @@ -118,7 +118,7 @@

Argumentstimeout -

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

+

(Optional) Number of seconds StatCan is allowed to go without sending data before the download is abandoned, to work around scenarios where StatCan servers drop the network connection. This does not limit how long a download may take overall, a transfer that keeps delivering data is left alone. StatCan prepares a whole response before sending any of it, which for large requests can take the better part of a minute, so values much below the default of 200 risk cutting off legitimate requests.

factors
@@ -147,16 +147,16 @@

Examples#> # A tibble: 10 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> <chr> <date> <fct> <fct> <dbl> <dbl> <chr> <chr> -#> 1 2025-09-… 2025-09-01 Cana… All-items 165. 165. 2002… 17 -#> 2 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 -#> 3 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 -#> 4 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 -#> 5 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 -#> 6 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 -#> 7 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 -#> 8 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 -#> 9 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 -#> 10 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 +#> 1 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 +#> 2 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 +#> 3 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 +#> 4 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 +#> 5 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 +#> 6 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 +#> 7 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 +#> 8 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 +#> 9 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 +#> 10 2026-07-… 2026-07-01 Cana… All-items 170. 170. 2002… 17 #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID <int>, VECTOR <chr>, cansimTableNumber <chr>, #> # COORDINATE <chr>, SYMBOL <int>, releaseTime <chr>, frequencyCode <int>, diff --git a/docs/reference/get_cansim_vector_for_latest_periods.md b/docs/reference/get_cansim_vector_for_latest_periods.md index 299d3b95..f37e5669 100644 --- a/docs/reference/get_cansim_vector_for_latest_periods.md +++ b/docs/reference/get_cansim_vector_for_latest_periods.md @@ -50,8 +50,14 @@ get_cansim_vector_for_latest_periods( - timeout: - (Optional) Timeout in seconds for downloading cansim table to work - around scenarios where StatCan servers drop the network connection. + (Optional) Number of seconds StatCan is allowed to go without sending + data before the download is abandoned, to work around scenarios where + StatCan servers drop the network connection. This does not limit how + long a download may take overall, a transfer that keeps delivering + data is left alone. StatCan prepares a whole response before sending + any of it, which for large requests can take the better part of a + minute, so values much below the default of 200 risk cutting off + legitimate requests. - factors: @@ -84,16 +90,16 @@ get_cansim_vector_for_latest_periods("v41690973",10) #> # A tibble: 10 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> -#> 1 2025-09-… 2025-09-01 Cana… All-items 165. 165. 2002… 17 -#> 2 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 -#> 3 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 -#> 4 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 -#> 5 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 -#> 6 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 -#> 7 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 -#> 8 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 -#> 9 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 -#> 10 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 +#> 1 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 +#> 2 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 +#> 3 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 +#> 4 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 +#> 5 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 +#> 6 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 +#> 7 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 +#> 8 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 +#> 9 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 +#> 10 2026-07-… 2026-07-01 Cana… All-items 170. 170. 2002… 17 #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , diff --git a/docs/reference/index.html b/docs/reference/index.html index 2b326af9..dd13b93e 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -120,6 +120,13 @@

Local database caching
Collect data from a parquet, feather or sqlite query and normalize cansim table output
+
+ + disconnect_cansim_connection() + +
+
Disconnect from a cansim connection
+
list_cansim_cached_tables() @@ -139,7 +146,7 @@

Local database cachingdisconnect_cansim_sqlite()

-
Disconnect from a cansim database connection
+
Disconnect from a cansim database connection (deprecated)
@@ -205,6 +212,20 @@

Locating dataget_cansim_changed_series_data_for_vectors() + +

+
Retrieve data for series that changed, by vector
+ +
+ + get_cansim_changed_series_data_for_coordinates() + +
+
Retrieve data for series that changed, by table and coordinate

Metadata and information

diff --git a/docs/reference/index.md b/docs/reference/index.md index bdc74546..32f7afb3 100644 --- a/docs/reference/index.md +++ b/docs/reference/index.md @@ -26,12 +26,14 @@ Managing data in local database - [`collect_and_normalize()`](https://mountainmath.github.io/cansim/reference/collect_and_normalize.md) : Collect data from a parquet, feather or sqlite query and normalize cansim table output +- [`disconnect_cansim_connection()`](https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.md) + : Disconnect from a cansim connection - [`list_cansim_cached_tables()`](https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.md) : List cached cansim arrow and SQlite databases - [`remove_cansim_cached_tables()`](https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.md) : Remove cached cansim SQLite and parquet database - [`disconnect_cansim_sqlite()`](https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.md) - : Disconnect from a cansim database connection + : Disconnect from a cansim database connection (deprecated) - [`cansim_repartition_cached_table()`](https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.md) : Repartitions a cached cansim table to a new partitioning scheme - [`set_cansim_cache_path()`](https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.md) @@ -53,6 +55,10 @@ Help with data discovery : Get the latest release data for a StatCan table, if available - [`get_cansim_key_release_schedule()`](https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.md) : Major economic indicator release schedule +- [`get_cansim_changed_series_data_for_vectors()`](https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.md) + : Retrieve data for series that changed, by vector +- [`get_cansim_changed_series_data_for_coordinates()`](https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.md) + : Retrieve data for series that changed, by table and coordinate ## Metadata and information diff --git a/docs/reference/remove_cansim_sqlite_cached_table.html b/docs/reference/remove_cansim_sqlite_cached_table.html index fb09a86c..b71602e4 100644 --- a/docs/reference/remove_cansim_sqlite_cached_table.html +++ b/docs/reference/remove_cansim_sqlite_cached_table.html @@ -103,7 +103,7 @@

Value

Examples

if (FALSE) { # \dontrun{
 con <- get_cansim_connection("34-10-0013", format="sqlite")
-disconnect_cansim_sqlite(con)
+disconnect_cansim_connection(con)
 remove_cansim_cached_tables("34-10-0013", format="sqlite")
 } # }
 
diff --git a/docs/reference/remove_cansim_sqlite_cached_table.md b/docs/reference/remove_cansim_sqlite_cached_table.md index 04897dcf..99fccc8f 100644 --- a/docs/reference/remove_cansim_sqlite_cached_table.md +++ b/docs/reference/remove_cansim_sqlite_cached_table.md @@ -39,7 +39,7 @@ remove_cansim_sqlite_cached_table( ``` r if (FALSE) { # \dontrun{ con <- get_cansim_connection("34-10-0013", format="sqlite") -disconnect_cansim_sqlite(con) +disconnect_cansim_connection(con) remove_cansim_cached_tables("34-10-0013", format="sqlite") } # } ``` diff --git a/docs/search.json b/docs/search.json index ba829377..54412371 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://mountainmath.github.io/cansim/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Jens von Bergmann Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"about","dir":"Articles","previous_headings":"","what":"About","title":"Getting started with the cansim package","text":"cansim package provides R bindings Statistics Canada’s main socioeconomic time series database, previously known (frequently referred package, elsewhere, ) CANSIM. Data can accessed table number, vector table number coordinate. package accepts old new (NDM) CANSIM table catalogue numbers.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"installing-cansim","dir":"Articles","previous_headings":"","what":"Installing cansim","title":"Getting started with the cansim package","text":"cansim package available CRAN can installed directly using default package installation process: Alternatively, latest development version package can downloaded Github using devtools remotes packages.","code":"install.packages(\"cansim\") # install.packages(\"remotes\") remotes::install_github(\"mountainmath/cansim\") library(cansim)"},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"usage","dir":"Articles","previous_headings":"","what":"Usage","title":"Getting started with the cansim package","text":"know data table catalogue number interested , use get_cansim download entire table. default, data tables retrieved package comes original format provided Statistics Canada enriched several added columns transformations. additional Date column added tries intelligently infer Date object REF_DATE column. additional val_norm column added, applies appropriate scaling factor VALUE column. data coded “thousands dollars”, value 2.4 VALUE column converted value 2400 val_norm column. Similarly, percentage 12.2 VALUE column converted value 0.122 val_norm column. Categorical variables converted factors , necessarily, de-duplicated appending name “parent” category parenthesis. ensures column variables unique retain original ordering. Taking look overview data within table common first step. implemented package get_cansim_table_overview(table_number) function. table number unknown, can browse available tables search survey name, keyword title. Individual series Statistics Canada data tables can also accessed using individual numbered vectors. especially useful building reports using specific indicators. convenience, cansim package allows users specify named vectors, label field added returned data frame containing specified name vector. Larger tables, tables update infrequently can cached database form faster access better performance. get_cansim_connection function facilitates , works mostly identitcal get_cansim function, returns database connection local database StatCan Table data. Calling collect_and_normalize, possibly filtering data, adds metadata loads data memory form identical data retrieved get_cansim. information refer Working large tables vignette.","code":"data <- get_cansim(\"14-10-0293\") #> Accessing CANSIM NDM product 14-10-0293 from Statistics Canada #> Parsing data head(data) #> # A tibble: 6 × 24 #> REF_DATE Date GEO DGUID GeoUID Labour force charact…¹ Statistics #> #> 1 2001-03 2001-03-01 Canada 2016A0000… 11124 Population Estimate #> 2 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Estimate #> 3 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 4 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 5 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Estimate #> 6 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Standard … #> # ℹ abbreviated name: ¹​`Labour force characteristics` #> # ℹ 17 more variables: VALUE , val_norm , UOM , UOM_ID , #> # SCALAR_FACTOR , SCALAR_ID , VECTOR , COORDINATE , #> # STATUS , SYMBOL , TERMINATED , DECIMALS , #> # `Hierarchy for GEO` , #> # `Classification Code for Labour force characteristics` , #> # `Hierarchy for Labour force characteristics` , … get_cansim_table_overview(\"14-10-0293\") #> Reading CANSIM NDM product 14-10-0293 information from cache. #> Labour force characteristics by economic region, three-month moving average, unadjusted for seasonality, last 5 months, inactive #> CANSIM Table 14-10-0293 #> Start Reference Period: 2001-03-01, End Reference Period: 2020-12-01, Frequency: Monthly #> #> Column Geography (76) #> Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia, ... #> #> Column Labour force characteristics (10) #> Labour force, Not in labour force, Employment, Unemployment, Full-time employment, Part-time employment, Population, Unemployment rate, Participation rate, Employment rate #> #> Column Statistics (3) #> Estimate, Standard error of estimate, Standard error of year-over-year change search_cansim_cubes(\"housing price indexes\") #> Retrieving cube information from StatCan servers... #> Warning: StatCan returned table titles or dimension names containing non-breaking spaces #> or control characters. These render as an ordinary space or as nothing at all, #> so the names cannot be typed or copy-pasted, the package has replaced them with #> regular spaces. Repaired 120 names, for example \"… end of the fiscal year #> ending closest to December31\". Nothing on your end causes this and #> nothing on your end can fix it, the characters are in the data StatCan #> publishes. This warning will disappear on its own once StatCan stops sending #> them, which is tracked at https://github.com/mountainMath/cansim/issues/169. #> Set options(cansim.suppress_repair_warnings=TRUE) to silence this. #> # A tibble: 2 × 20 #> cansim_table_number cubeTitleEn cubeTitleFr productId cansimId cubeStartDate #> #> 1 18-10-0073 New housing … Indices de… 18100073 327-0005 1981-01-01 #> 2 18-10-0095 New housing … Indices de… 18100095 327-0029 1981-01-01 #> # ℹ 14 more variables: cubeEndDate , releaseTime , archived , #> # subjectCode , surveyCode , frequencyCode , #> # corrections , issueDate , dimensionNameEn , #> # dimensionNameFr , surveyEn , surveyFr , subjectEn , #> # subjectFr get_cansim_vector(c(\"Metro Van Apartment Construction Price Index\"=\"v44176267\", \"Metro Van CPI\"=\"v41692930\"), start_time = \"2015-05-01\", end_time=\"2015-08-01\") |> dplyr::select(Date,GEO,label,VALUE,val_norm) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 5 × 5 #> Date GEO label VALUE val_norm #> #> 1 2015-05-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 2 2015-06-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 3 2015-07-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 4 2015-08-01 Vancouver, British Columbia Metro Van CPI 123. 123. #> 5 2015-07-01 Vancouver, British Columbia Metro Van Apartment Con… 153 153 data <- get_cansim_connection(\"14-10-0293\") |> collect_and_normalize() #> Reading CANSIM NDM product 14-10-0293 from parquet. head(data) #> # A tibble: 6 × 24 #> REF_DATE Date GEO DGUID GeoUID Labour force charact…¹ Statistics #> #> 1 2001-03 2001-03-01 Canada 2016A0000… 11124 Population Estimate #> 2 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Estimate #> 3 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 4 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 5 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Estimate #> 6 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Standard … #> # ℹ abbreviated name: ¹​`Labour force characteristics` #> # ℹ 17 more variables: VALUE , val_norm , UOM , UOM_ID , #> # SCALAR_FACTOR , SCALAR_ID , VECTOR , COORDINATE , #> # STATUS , SYMBOL , TERMINATED , DECIMALS , #> # `Hierarchy for GEO` , #> # `Classification Code for Labour force characteristics` , #> # `Hierarchy for Labour force characteristics` , …"},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"license","dir":"Articles","previous_headings":"","what":"License","title":"Getting started with the cansim package","text":"code package licensed MIT license. bundled table metadata Sysdata.R, well Statistics Canada data retrieved using package made available Statistics Canada Open Licence Agreement, copy included R folder. Statistics Canada Open Licence Agreement requires :","code":"Subject to this agreement, Statistics Canada grants you a worldwide, royalty-free, non-exclusive licence to: - use, reproduce, publish, freely distribute, or sell the Information; - use, reproduce, publish, freely distribute, or sell Value-added Products; and, - sublicence any or all such rights, under terms consistent with this agreement. In doing any of the above, you shall: - reproduce the Information accurately; - not use the Information in a way that suggests that Statistics Canada endorses you or your use of the Information; - not misrepresent the Information or its source; - use the Information in a manner that does not breach or infringe any applicable laws; - not merge or link the Information with any other databases for the purpose of attempting to identify an individual person, business or organization; and - not present the Information in such a manner that gives the appearance that you may have received, or had access to, information held by Statistics Canada about any identifiable individual person, business or organization."},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"attribution","dir":"Articles","previous_headings":"","what":"Attribution","title":"Getting started with the cansim package","text":"Subject Statistics Canada Open Licence Agreement, licensed products using Statistics Canada data employ following acknowledgement source:","code":"Acknowledgment of Source (a) You shall include and maintain the following notice on all licensed rights of the Information: - Source: Statistics Canada, name of product, reference date. Reproduced and distributed on an \"as is\" basis with the permission of Statistics Canada. (b) Where any Information is contained within a Value-added Product, you shall include on such Value-added Product the following notice: - Adapted from Statistics Canada, name of product, reference date. This does not constitute an endorsement by Statistics Canada of this product."},{"path":"https://mountainmath.github.io/cansim/articles/listing_cansim_tables.html","id":"listing-and-filtering-tables","dir":"Articles","previous_headings":"","what":"Listing and filtering tables","title":"Listing Statistics Canada data tables","text":"Calling list_cansim_cubes returns data frame useful metadata available tables. 21 fields metadata table including title, English French, keyword sets, notes, table numbers. appropriate table can found subsetting filtering properties want use find appropriate tables. search came two tables. example interested unemployment rate 2015 onward Lower Mainland, Vancouver Island, Okanagan economic regions Labour Force Characteristics table. use tidyr package reshape data long format wider format. can visualize results ggplot2.","code":"library(cansim) names(list_cansim_cubes()) #> Retrieving cube information from StatCan servers... #> Warning: StatCan returned table titles or dimension names containing non-breaking spaces #> or control characters. These render as an ordinary space or as nothing at all, #> so the names cannot be typed or copy-pasted, the package has replaced them with #> regular spaces. Repaired 120 names, for example \"… end of the fiscal year #> ending closest to December31\". Nothing on your end causes this and #> nothing on your end can fix it, the characters are in the data StatCan #> publishes. This warning will disappear on its own once StatCan stops sending #> them, which is tracked at https://github.com/mountainMath/cansim/issues/169. #> Set options(cansim.suppress_repair_warnings=TRUE) to silence this. #> [1] \"cansim_table_number\" \"cubeTitleEn\" \"cubeTitleFr\" #> [4] \"productId\" \"cansimId\" \"cubeStartDate\" #> [7] \"cubeEndDate\" \"releaseTime\" \"archived\" #> [10] \"subjectCode\" \"surveyCode\" \"frequencyCode\" #> [13] \"corrections\" \"issueDate\" \"dimensionNameEn\" #> [16] \"dimensionNameFr\" \"surveyEn\" \"surveyFr\" #> [19] \"subjectEn\" \"subjectFr\" library(dplyr, warn.conflicts = FALSE) list_cansim_cubes() %>% filter(grepl(\"Labour force characteristics\",cubeTitleEn), grepl(\"economic region\",cubeTitleEn)) %>% select(cansim_table_number,cubeTitleEn) #> Retrieving cube information from temporary cache. #> # A tibble: 4 × 2 #> cansim_table_number cubeTitleEn #> #> 1 14-10-0090 Labour force characteristics by province, territory and e… #> 2 14-10-0293 Labour force characteristics by economic region, three-mo… #> 3 14-10-0462 Labour force characteristics by economic region, three-mo… #> 4 14-10-0464 Labour force characteristics by province, territory and e… library(tidyr) selected_table <- \"14-10-0293\" data <-get_cansim(selected_table) %>% filter(grepl(\"Mainland|Vancouver Island|Okanagan\", GEO), Date>=as.Date(\"2015-01-01\"), `Labour force characteristics`==\"Unemployment rate\") %>% select(Date, GEO, Statistics, val_norm) %>% spread(key=\"Statistics\", value=val_norm) #> Accessing CANSIM NDM product 14-10-0293 from Statistics Canada #> Parsing data library(ggplot2) ggplot(data, aes(x=Date, group = GEO,y=Estimate)) + geom_ribbon(aes(ymin=Estimate - `Standard error of estimate`, ymax=Estimate + `Standard error of estimate`, fill=\"\"), alpha=0.8) + geom_line(aes(color=GEO)) + scale_y_continuous(labels=scales::percent) + scale_fill_manual(name = \"\", values=\"grey80\", label=\"Standard error\") + theme_bw() + labs(title = \"Comparison of unemployment rate by economic region\", y = \"Unemployment Rate\", x = \"\", color = \"\", caption=paste0(\"CANSIM \", selected_table))"},{"path":"https://mountainmath.github.io/cansim/articles/partial_table_data_download.html","id":"using-vectors-instead-of-coordinates","dir":"Articles","previous_headings":"","what":"Using vectors instead of coordinates","title":"Partial table data download","text":"can achieved downloading data vectors. need add vector information table template. Vector information available coordinates, also gives effective way filter invalid coordinate combinations template. Vector information available census data tables. gives us data , possibly shorter time series coordinates querying data vector pull data times specific vector available. accessed vector coordinate data differ limited way, values difference NA won’t affect results. completeness plot vector data obtain identical graph.","code":"bp_template_filtered_vecotrs <- bp_template_filtered |> add_cansim_vectors_to_template() bp_data_vector <- bp_template_filtered_vecotrs$VECTOR |> na.omit() |> get_cansim_vector() #> Accessing CANSIM NDM vectors from Statistics Canada bp_data_vector |> mutate(Value=case_when( # count demolitions and deconversions as negative Variables %in% c(\"Number of dwelling-units demolished\",\"Number of dwelling-units lost\") ~ - val_norm, TRUE ~ val_norm )) |> mutate(Name=gsub(\", .+\",\"\",GEO), Year=strftime(Date,\"%Y\")) |> summarize(Value=sum(Value),n=n(),.by=c(Name,Year,`Type of work`)) |> filter(n==12,!is.na(Value)) |> # only show years with complete 12 months of data ggplot(aes(x=Year,y=Value,fill=`Type of work`)) + geom_bar(stat=\"identity\") + facet_wrap(~Name,scales=\"free_y\") + scale_y_continuous(labels=scales::comma) + theme(axis.text.x = element_text(angle=90, hjust=1)) + labs(title=\"Building permits for residential structures in Canadian metro areas\", y=\"Number of dwelling units\", x=NULL, fill=\"Metric\", caption=\"StatCan Table 34-10-0285\")"},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"retrieving-individual-vectors","dir":"Articles","previous_headings":"","what":"Retrieving individual vectors","title":"Retrieving individual Statistics Canada vectors","text":"Many time-series data available Statistics Canada individual vector codes. vector codes follow naming format lower-case “v” identifying numbers. Time-series tables often bundle many series together, resulting large sometimes unwieldy files. Many users Canadian statistical data, often concerned specific time series CPI international arrivals, typically know exact series need. reason, cansim package also provides two functions make easier retrieve individual vectors: get_cansim_vector() get_cansim_vector_for_latest_periods().","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"get_cansim_vector","dir":"Articles","previous_headings":"","what":"get_cansim_vector()","title":"Retrieving individual Statistics Canada vectors","text":"Running search_cansim_cubes(\"consumer price index\") shows 32 tables results. However, tracking Canadian Consumer Price Index (CPI) time, might already know Statistics Canada vector code seasonally-unadjusted -items CPI value: v41690973. retrieve just data series without additional data available related tables, can use get_cansim_vector() function vector code date onwards want get vector results . call get_cansim_vector takes three inputs: string code (codes) vectors, start_time YYYY-MM-DD format, optional value end_time, also YYYY-MM-DD format. default, start_time end_time vectors uses Statistics Canada’s reference periods (“REF_DATE”) selecting date range data retrieved vectors. optional input parameters function. end_time provided, call use current date default series end time. optional parameter use_ref_date set FALSE, vector retrieval instead filter release date vector . Vectors can coerced list object order retrieve multiple series time. example, provincial seasonally-unadjusted CPI values vector codes. vector code British Columbia -items CPI v41692462. code retrieves monthly Canadian BC CPI values period January 2015 December 2017 . Monthly data series always dated first day month.","code":"get_cansim_vector(\"v41690973\",\"2015-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 138 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2015-01-… 2015-01-01 Cana… All-items 124. 124. 2002… 17 #> 2 2015-02-… 2015-02-01 Cana… All-items 125. 125. 2002… 17 #> 3 2015-03-… 2015-03-01 Cana… All-items 126. 126. 2002… 17 #> 4 2015-04-… 2015-04-01 Cana… All-items 126. 126. 2002… 17 #> 5 2015-05-… 2015-05-01 Cana… All-items 127. 127. 2002… 17 #> 6 2015-06-… 2015-06-01 Cana… All-items 127. 127. 2002… 17 #> 7 2015-07-… 2015-07-01 Cana… All-items 127. 127. 2002… 17 #> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 #> # ℹ 128 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS vectors <- c(\"v41690973\",\"v41692462\") get_cansim_vector(vectors, \"2017-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 228 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2017-01-… 2017-01-01 Cana… All-items 130. 130. 2002… 17 #> 2 2017-02-… 2017-02-01 Cana… All-items 130. 130. 2002… 17 #> 3 2017-03-… 2017-03-01 Cana… All-items 130. 130. 2002… 17 #> 4 2017-04-… 2017-04-01 Cana… All-items 130. 130. 2002… 17 #> 5 2017-05-… 2017-05-01 Cana… All-items 130. 130. 2002… 17 #> 6 2017-06-… 2017-06-01 Cana… All-items 130. 130. 2002… 17 #> 7 2017-07-… 2017-07-01 Cana… All-items 130. 130. 2002… 17 #> 8 2017-08-… 2017-08-01 Cana… All-items 130. 130. 2002… 17 #> 9 2017-09-… 2017-09-01 Cana… All-items 131. 131. 2002… 17 #> 10 2017-10-… 2017-10-01 Cana… All-items 131. 131. 2002… 17 #> # ℹ 218 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS "},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"get_cansim_vectors_for_latest_periods","dir":"Articles","previous_headings":"","what":"get_cansim_vectors_for_latest_periods()","title":"Retrieving individual Statistics Canada vectors","text":"vectors extend backwards significant number periods may interest. get_cansim_vectors_for_lates_periods() wrapper around get_cansim_vectors takes periods input instead arguments start_time end_time, provides data selected vector(s) last n periods data available, irrespective dates.","code":"get_cansim_vector_for_latest_periods(\"v41690973\", periods = 60) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 60 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2021-07-… 2021-07-01 Cana… All-items 142. 142. 2002… 17 #> 2 2021-08-… 2021-08-01 Cana… All-items 143. 143. 2002… 17 #> 3 2021-09-… 2021-09-01 Cana… All-items 143. 143. 2002… 17 #> 4 2021-10-… 2021-10-01 Cana… All-items 144. 144. 2002… 17 #> 5 2021-11-… 2021-11-01 Cana… All-items 144. 144. 2002… 17 #> 6 2021-12-… 2021-12-01 Cana… All-items 144 144 2002… 17 #> 7 2022-01-… 2022-01-01 Cana… All-items 145. 145. 2002… 17 #> 8 2022-02-… 2022-02-01 Cana… All-items 147. 147. 2002… 17 #> 9 2022-03-… 2022-03-01 Cana… All-items 149. 149. 2002… 17 #> 10 2022-04-… 2022-04-01 Cana… All-items 150. 150. 2002… 17 #> # ℹ 50 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS "},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"naming-vector-series","dir":"Articles","previous_headings":"","what":"Naming vector series","title":"Retrieving individual Statistics Canada vectors","text":"examples, used v41690973 Canada v41692462 BC. can hard remember can get annoying work . vector retrieval functions cansim package allow named vector extraction. works providing user-determined string directly get_* call. may useful working table code vector codes information name become easy lose track .","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"normalizing-data","dir":"Articles","previous_headings":"","what":"Normalizing data","title":"Retrieving individual Statistics Canada vectors","text":"Data retrieved vectors also gains additional val_norm column normalized values.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"putting-it-all-together","dir":"Articles","previous_headings":"","what":"Putting it all together","title":"Retrieving individual Statistics Canada vectors","text":"quick example uses list two named vectors starting date input value, converts values (“normalizes”) fly, prepares simple ggplot2 graphic. access metadata vectors can use get_cansim_vector_info call","code":"vectors <- c(\"Canadian CPI\"=\"v41690973\", \"BC CPI\"=\"v41692462\") data <- get_cansim_vector(vectors, \"2010-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada library(ggplot2) ggplot(data,aes(x=Date,y=val_norm,color=label)) + geom_line() + labs(title=\"Consumer Price Index, January 2010 to September 2018\", subtitle = \"Seasonally-unadjusted, all-items (2002 = 100)\", caption=paste0(\"CANSIM vectors \",paste0(vectors,collapse = \", \")),x=\"\",y=\"\",color=\"\") get_cansim_vector_info(vectors) #> # A tibble: 2 × 10 #> DECIMALS VECTOR table COORDINATE title_en title_fr UOM frequencyCode #> #> 1 1 v41690973 18-10-0004 2.2 Canada;… Canada;… 17 6 #> 2 1 v41692462 18-10-0004 26.2 British… Colombi… 17 6 #> # ℹ 2 more variables: SCALAR_ID , title "},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"retrieving-metadata","dir":"Articles","previous_headings":"","what":"Retrieving metadata","title":"Working with Statistics Canada data table object hierarchies","text":"get_cansim_table_overview function displays overview table information. table yet downloaded cached first download table . Let’s take look ’s table interested .","code":"library(cansim) # select a table number table_id = \"36-10-0402\" # get table overview get_cansim_table_overview(table_id) #> Gross domestic product (GDP) at basic prices, by industry, provinces and territories, inactive #> CANSIM Table 36-10-0402 #> Start Reference Period: 1997-01-01, End Reference Period: 2024-01-01, Frequency: 12 #> #> Column Geography (13) #> Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia, ... #> #> Column Prices (3) #> Current dollars, Chained (2017) dollars, Contributions to percent change #> #> Column North American Industry Classification System (NAICS) (337) #> All industries, Goods-producing industries, Service-producing industries, Industrial production, Non-durable manufacturing industries, Durable manufacturing industries, Information and communication technology sector, Information and communication technology, manufacturing, Information and communication technology, services, Energy sector, ..."},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"accessing-table-data","dir":"Articles","previous_headings":"","what":"Accessing table data","title":"Working with Statistics Canada data table object hierarchies","text":"see data set come three different measures 307 different NAICS values. Let’s load data focus just “Chained (2017) dollars”.","code":"library(dplyr, warn.conflicts = FALSE) data <- get_cansim(table_id) #> Reading CANSIM NDM product 36-10-0402 from cache. selected_value = data$Prices[grepl(\"Chained\",data$Prices)] %>% unique() data <- data %>% filter(Prices == selected_value)"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"taking-advantage-of-metadata","dir":"Articles","previous_headings":"","what":"Taking advantage of metadata","title":"Working with Statistics Canada data table object hierarchies","text":"table includes different levels NAICS categories one dimension. makes working data level rather cumbersome often interested specific sub-categories. internal hierarchy can help . Let’s first get overview data. can also use easily compute shares instead totals. can extract hierarchy using built-convenience function categories_for_level takes cansim-package retrieved data table object metadata input requires field extract categories well level indicating target depth level hierarchy wish extract.","code":"# Extract top-level hierarchy to calculate total top_level <- categories_for_level(data, \"North American Industry Classification System (NAICS)\",0) # Extract total using hierarchy and calculate share by NAICS. # This could also be done using grouping functions from dplyr, # but we wanted to demonstrate how to use specific hierarchy levels. total_data <- data %>% filter(`North American Industry Classification System (NAICS)` %in% top_level) %>% rename(Total = val_norm) %>% select(Date, GEO, Total) # Merge total back in and calculate share for every NAICS code data <- data %>% left_join(total_data,by = c(\"Date\", \"GEO\")) %>% mutate(Share = val_norm/Total)"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"hierarchies-in-more-detail","dir":"Articles","previous_headings":"","what":"Hierarchies in more detail","title":"Working with Statistics Canada data table object hierarchies","text":"hundreds NAICS codes many make sense time. can use categories_for_level reduce NAICS codes just first sub-level represents industry groups. can call subset cut_data. (Note NAICS data also includes composite groups industries, something like level 0.5 hierarchy, prefixed “T” want remove well.) still 22 level 1 categories, many sensibly visualize time. can use dplyr functions identify top categories group rest can plot easier understand. data prepared, last step putting together visualization using ggplot2. can see adjustments required. Let’s closer look “Real estate rental leasing” “Construction” categories. turn categories_for_level function make grabbing sub-categories easier process. observe resulting chart largest contributors GDP sector British Columbia Owner-occupied dwellings (imputed rent) Lessors Real estate (rent), followed Residential building construction.","code":"cut_data <- data %>% filter( !grepl(\"T\\\\d+\",`Classification Code for North American Industry Classification System (NAICS)`), `North American Industry Classification System (NAICS)` %in% categories_for_level(.,\"North American Industry Classification System (NAICS)\",1)) # How many are NAICS categories left? n <- length(cut_data$`North American Industry Classification System (NAICS)` %>% unique) # Specify which regions and period we want to look at regions = \"British Columbia\" period = \"2019-07-01\" # Select the top-8 categories for our reference region and period top_categories <- cut_data %>% filter(GEO %in% regions, Date == period) %>% top_n(8,Share) %>% pull(\"North American Industry Classification System (NAICS)\") # Group remaining categories together and prepare data for plot plot_data <- cut_data %>% mutate(NAICS = ifelse(`North American Industry Classification System (NAICS)` %in% top_categories,`North American Industry Classification System (NAICS)`,\"Rest\")) %>% select(Date, GEO, NAICS, VALUE, Share) %>% group_by(Date, GEO, NAICS) %>% summarise(VALUE = sum(VALUE, na.rm = TRUE), Share = sum(Share, na.rm = TRUE), .groups = \"drop\") library(ggplot2) ggplot(plot_data %>% filter(GEO %in% regions), aes(x = Date, y = Share, fill = NAICS)) + geom_area(position=\"stack\") + scale_y_continuous(labels = scales::percent) + theme_bw() + theme(legend.position = \"bottom\",legend.direction =\"vertical\") + guides(fill=guide_legend(ncol = 3)) + labs(title=\"Gross domestic product (GDP) at basic prices\", subtitle=selected_value, x=\"\", fill = \"\", caption=paste0(\"CANSIM \", table_id)) real_construction <- c(\"Construction [23]\",\"Real estate and rental and leasing [53]\") # Get the NAICS hierarchy codes just for these categories rrl_hierarchy <- data %>% filter(`North American Industry Classification System (NAICS)` %in% real_construction) %>% pull(\"Hierarchy for North American Industry Classification System (NAICS)\") %>% unique # Filter out all sub-categories for Real Estate. # The paste with | trick ensures that we grepl for all matches. rrl_data <- data %>% filter(grepl(paste(rrl_hierarchy,collapse=\"|\"),`Hierarchy for North American Industry Classification System (NAICS)`)) # Ensure we only retain the NAICS leaves and none of the aggregate subcategories rrl_data <- rrl_data %>% filter( `North American Industry Classification System (NAICS)` %in% categories_for_level(.,\"North American Industry Classification System (NAICS)\")) %>% rename(NAICS=`North American Industry Classification System (NAICS)`) # Plot with labels from our original selections ggplot(rrl_data %>% filter(GEO %in% regions), aes(x = Date, y = Share, fill = NAICS)) + geom_area(position = \"stack\") + scale_y_continuous(labels = scales::percent) + theme_bw() + theme(legend.position = \"bottom\",legend.direction =\"vertical\") + guides(fill=guide_legend(ncol=1)) + labs(title=\"Gross domestic product (GDP) at basic prices\", subtitle=paste0(regions,\", \", selected_value), x=\"\", caption=paste0(\"CANSIM \", table_id))"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"working-with-cached-tables","dir":"Articles","previous_headings":"","what":"Working with cached tables","title":"Working with large tables","text":"data cached function download data first convert specified format. package designed differences database formats mostly abstracted away. make good use data look metadata inspect member columns variables available. gives us understanding available variables. purpose vignette interested breakdown sales units Vehicle type Canada overall. data stored raw form database, processing done augmented GeoUID. parquet feather sqlite get_cansim_table_overview(\"20-10-0001\") #> Reading CANSIM NDM product 20-10-0001 information cache. #> New motor vehicle sales, inactive #> CANSIM Table 20-10-0001 #> Start Reference Period: 1946-01-01, End Reference Period: 2024-12-01, Frequency: Monthly #> #> Column Geography (11) #> Newfoundland Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia Territories, ... #> #> Column Vehicle type (3) #> Passenger cars, Trucks, Total, new motor vehicles #> #> Column Origin manufacture (5) #> North America, Total, overseas, Japan, countries, Total, country manufacture #> #> Column Sales (2) #> Units, Dollars #> #> Column Seasonal adjustment (2) #> Unadjusted, Seasonally adjusted","code":"connection.parquet <- get_cansim_connection(\"20-10-0001\") # format='parquet' is the default #> Accessing CANSIM NDM product 20-10-0001 from Statistics Canada #> Parsing data to parquet. glimpse(connection.parquet) #> FileSystemDataset with 1 Parquet file #> 163,410 rows x 19 columns #> $ REF_DATE \"1983-05\", \"1983-05\", \"1983-05\", \"1983-05\", \"… #> $ GEO \"Manitoba\", \"Manitoba\", \"Manitoba\", \"Manitoba… #> $ DGUID \"2016A000246\", \"2016A000246\", \"2016A000246\", … #> $ `Vehicle type` \"Passenger cars\", \"Passenger cars\", \"Passenge… #> $ `Origin of manufacture` \"North America\", \"North America\", \"Total, ove… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Un… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ UOM_ID \"300\", \"81\", \"300\", \"81\", \"300\", \"81\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"thousands\", \"… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", … #> $ VECTOR \"v42170161\", \"v42170162\", \"v42170163\", \"v4217… #> $ COORDINATE \"8.2.2.1.1\", \"8.2.2.2.1\", \"8.2.3.1.1\", \"8.2.3… #> $ VALUE 2261, 24380, 657, 6552, 578, 5246, 79, 1306, … #> $ STATUS NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ TERMINATED NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", … #> $ GeoUID \"46\", \"46\", \"46\", \"46\", \"46\", \"46\", \"46\", \"46… #> Call `print()` for full schema details connection.feather <- get_cansim_connection(\"20-10-0001\", format='feather') #> Accessing CANSIM NDM product 20-10-0001 from Statistics Canada #> Parsing data to feather. glimpse(connection.feather) #> FileSystemDataset with 1 Feather file #> 163,410 rows x 19 columns #> $ REF_DATE \"1980-11\", \"1980-11\", \"1980-11\", \"1980-11\", \"… #> $ GEO \"New Brunswick\", \"New Brunswick\", \"New Brunsw… #> $ DGUID \"2016A000213\", \"2016A000213\", \"2016A000213\", … #> $ `Vehicle type` \"Passenger cars\", \"Passenger cars\", \"Passenge… #> $ `Origin of manufacture` \"North America\", \"North America\", \"Total, ove… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Un… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ UOM_ID \"300\", \"81\", \"300\", \"81\", \"300\", \"81\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"thousands\", \"… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", … #> $ VECTOR \"v42170080\", \"v42170081\", \"v42170082\", \"v4217… #> $ COORDINATE \"5.2.2.1.1\", \"5.2.2.2.1\", \"5.2.3.1.1\", \"5.2.3… #> $ VALUE 1290, 10346, 336, 2319, 243, 1645, 93, 674, N… #> $ STATUS NA, NA, NA, NA, NA, NA, NA, NA, \"x\", \"x\", NA,… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ TERMINATED NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", … #> $ GeoUID \"13\", \"13\", \"13\", \"13\", \"13\", \"13\", \"13\", \"13… #> Call `print()` for full schema details connection.sqlite <- get_cansim_connection(\"20-10-0001\", format='sqlite') #> Accessing CANSIM NDM product 20-10-0001 from Statistics Canada #> Parsing data to sqlite. #> Indexing GEO #> Indexing Vehicle type #> Indexing Origin of manufacture #> Indexing Sales #> Indexing Seasonal adjustment #> Indexing REF_DATE #> Indexing DGUID #> Indexing GeoUID glimpse(connection.sqlite) #> Rows: ?? #> Columns: 19 #> $ REF_DATE \"1946-01\", \"1946-01\", \"1946-01\", \"1946-01\", \"1… #> $ GEO \"Canada\", \"Canada\", \"Canada\", \"Canada\", \"Canad… #> $ GeoUID \"11124\", \"11124\", \"11124\", \"11124\", \"11124\", \"… #> $ DGUID \"2016A000011124\", \"2016A000011124\", \"2016A0000… #> $ `Vehicle type` \"Total, new motor vehicles\", \"Total, new motor… #> $ `Origin of manufacture` \"Total, country of manufacture\", \"Total, count… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Units\", \"Dollars… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Sea… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Units\", \"Dollars… #> $ UOM_ID \"300\", \"81\", \"300\", \"300\", \"81\", \"300\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"units\", \"thous… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"0\", \"3\", \"0\", \"0\", \"3\", \"0\", \"… #> $ VECTOR \"v42169911\", \"v42169913\", \"v42169920\", \"v42169… #> $ COORDINATE \"1.1.1.1.1\", \"1.1.1.2.1\", \"1.2.1.1.1\", \"1.2.1.… #> $ VALUE 2756, 4507, 1102, 1468, 1604, 1654, 2037, 2903… #> $ STATUS NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ TERMINATED NA, NA, NA, \"t\", NA, NA, \"t\", NA, NA, NA, NA, … #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"…"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"filtering-and-loading-into-memory","dir":"Articles","previous_headings":"","what":"Filtering and loading into memory","title":"Working with large tables","text":"order work data need load memory, done calling collect() connection object. want make use additional metadata processing cansim package usually main operations done connection filtering (renaming de-selecting columns needed enriching metadata) can utilize custom collect_and_normalize function time normalize data appear way used get_cansim function. add category hierarchy metadata normalized value column. case sqlite connections might want pass disconnect = TRUE argument collect_and_normalize function close connection normalizing data, manually later time via disconnect_cansim_sqlite(connection). required parquet feather connections. collect_and_normalize() interface designed used way across database formats. comparison also add “traditional” get_cansim() approach reads entire table memory normalizes data. parquet feather sqlite traditional","code":"data.parquet <- connection.parquet %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.parquet %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1983-06 1983-06-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1983-06 1983-06-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1983-07 1983-07-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1983-07 1983-07-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1983-08 1983-08-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1983-08 1983-08-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.feather <- connection.feather %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.feather %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1980-12 1980-12-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1980-12 1980-12-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1981-01 1981-01-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1981-01 1981-01-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1981-02 1981-02-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1981-02 1981-02-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.sqlite <- connection.sqlite %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.sqlite %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1946-01 1946-01-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1946-01 1946-01-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1946-02 1946-02-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1946-02 1946-02-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1946-03 1946-03-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1946-03 1946-03-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.memory <- get_cansim(\"20-10-0001\") %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) #> Accessing CANSIM NDM product 20-10-0001 from Statistics Canada #> Parsing data data.memory %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1946-01 1946-01-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1946-01 1946-01-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1946-02 1946-02-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1946-02 1946-02-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1946-03 1946-03-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1946-03 1946-03-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , …"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"section","dir":"Articles","previous_headings":"","what":"Working with large tables","title":"Working with large tables","text":"note syntax, resulting data frames, identical.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"working-with-the-data","dir":"Articles","previous_headings":"","what":"Working with the data","title":"Working with large tables","text":"three data formats producing output can now work data fetched subsequently filtered via get_cansim. Given data can filter date range plot .","code":"data.parquet %>% filter(Date>=as.Date(\"1990-01-01\")) %>% ggplot(aes(x=Date,y=val_norm,color=`Vehicle type`)) + geom_smooth(span=0.2,method = 'loess', formula = y ~ x) + theme(legend.position=\"bottom\") + scale_y_continuous(labels = function(d)scales::comma(d,scale=10^-3,suffix=\"k\")) + labs(title=\"Canada new motor vehicle sales\",caption=\"StatCan Table 20-10-0001\", x=NULL,y=\"Number of units\")"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"partitioning","dir":"Articles","previous_headings":"","what":"Partitioning","title":"Working with large tables","text":"improve read performance parquet feather data one can specify partioning argument calling get_cansim_connection. partition data specified columns. can useful filtering columns read relevant partitions greatly increase read performance sight cost size disk. example dataset mostly accessed filtering geographic regions, might useful partition GeoUID, GEO column querying data name. one partitioning column can specified, helpful large datasets high number dimensions. parquet dataset partitioned subsequent queries mind often faster data retrieval index SQLite database. arrow package guidance partitioning tradeoffs.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"repartitioning","dir":"Articles","previous_headings":"Partitioning Working with cached tables","what":"Repartitioning","title":"Working with large tables","text":"Partitioning happens initial data import changing partitioning parameter subsequent calls get_cansim_connection() won’t effect, although warning get issued specified partitioning empty differs initial partitioning. cases, example lots data queries dataset, might make sense occasionally change partitioning data order optimize read performance. can done cansim_repartition_cached_table() takes new_partitioning argument. Repartitioning happens fairly fast, taking several seconds fairly large tables original CSV several gigabytes size.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"keeping-track-of-cached-data","dir":"Articles","previous_headings":"","what":"Keeping track of cached data","title":"Working with large tables","text":"Since now option permanent cache take care manage space properly. list_cansim_sqlite_cached_tables function gives us overview cached data .","code":"list_cansim_cached_tables() #> # A tibble: 47 × 11 #> cansimTableNumber language dataFormat timeCached cansimVersion #> #> 1 11-10-0004 eng parquet 2025-07-18 22:22:12 NA #> 2 11-10-0008 eng parquet 2025-07-18 23:12:15 NA #> 3 11-10-0047 eng parquet 2025-07-15 14:44:05 NA #> 4 11-10-0223 eng parquet 2025-05-21 13:12:41 NA #> 5 11-10-0239 eng parquet 2026-04-29 07:34:19 NA #> 6 14-10-0293 eng parquet 2025-08-16 14:16:06 NA #> 7 14-10-0473 eng parquet 2025-02-24 09:45:30 NA #> 8 17-10-0004 eng parquet 2025-03-31 10:36:38 NA #> 9 17-10-0005 eng parquet 2025-12-13 23:11:30 NA #> 10 17-10-0008 eng parquet 2025-09-24 10:54:47 NA #> # ℹ 37 more rows #> # ℹ 6 more variables: niceSize , rawSize , title , path , #> # timeReleased , upToDate "},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"removing-cached-data","dir":"Articles","previous_headings":"","what":"Removing cached data","title":"Working with large tables","text":"want free disk space can remove cached table several tables. following call remove cached “20-10-0001” tables formats languages. disconnect connection sqlite database.","code":"disconnect_cansim_sqlite(connection.sqlite) remove_cansim_cached_tables(\"20-10-0001\") #> Removing feather cached data for 20-10-0001 (eng) #> Removing parquet cached data for 20-10-0001 (eng) #> Removing sqlite cached data for 20-10-0001 (eng)"},{"path":"https://mountainmath.github.io/cansim/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jens von Bergmann. Author, maintainer. Dmitry Shkolnik. Author.","code":""},{"path":"https://mountainmath.github.io/cansim/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"von Bergmann Shkolnik (2021). cansim: Accessing Statistics Canada Data Table Vectors. https://CRAN.R-project.org/package=cansim","code":"@Manual{, year = {2021}, author = {Jens {von Bergmann} and Dmitry Shkolnik}, title = {cansim: Accessing Statistics Canada Data Table and Vectors}, url = {https://CRAN.R-project.org/package=cansim}, }"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"cansim","dir":"","previous_headings":"","what":"Retrieve and work with public Statistics Canada data tables in R","title":"Retrieve and work with public Statistics Canada data tables in R","text":"R package retrieve work public Statistics Canada data tables. package: Searches retrieves data tables series Statistics Canada’s socioeconomic data repository (previously known CANSIM) Prepares retrieved data tables analysis-ready tidy data frames Accepts legacy CANSIM table catalogue numbers Allows bilingual data retrieval Offers caching downloaded data faster loading less waiting Includes convenience functions relabelling rescaling well tools working data hierarchies downloaded table objects","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Cansim R package home page reference guide","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Retrieve and work with public Statistics Canada data tables in R","text":"cansim package available CRAN can installed directly. Alternatively, latest development version can downloaded Github using either remotes devtools packages.","code":"install.packages(\"cansim\") # install.packages(\"remotes\") remotes::install_github(\"mountainmath/cansim\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"basic-usage","dir":"","previous_headings":"","what":"Basic Usage","title":"Retrieve and work with public Statistics Canada data tables in R","text":"package accepts use old-format (“051-0013”) new-format (“17-10-0016-01”) table catalogue numbers download entire data tables tidy data frames. Calling either legacy CANSIM table number new NDM number load data. Since transition new data repository, existing tables retained old-format numbers, newly created tables new-format names. See example usage workflow Getting started cansim package vignette.","code":"# Retrieve data for births table: 17-10-0016-01 (formerly: CANSIM 051-0013) births <- get_cansim(\"051-0013\") births <- get_cansim(\"17-10-0016\") # Retrieve data for balance of payment table 36-10-0042-01 (formerly CANSIM 376-8105) bop <- get_cansim(\"3768105\") bop <- get_cansim(\"36-10-0042\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"caching","dir":"","previous_headings":"","what":"Caching","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Many data tables available Statistics Canada’s data repository quite large size. downloading tables, cansim package cache data temporary directory duration current R session. reduces unnecessary waiting recompiling code. force refresh data, pass refresh=TRUE option function call. cache data sessions get_cansim_connection() function retrieves caches data local database returns database connection. allows database level filtering, data manipulation, summarizing calling collect_and_normalize() retrieve data data frame. Data retrieved way identical data retrieved via get_cansim(), possibly row order. call give identical output get_cansim(\"17-10-0016\"), commonly filter otherwise manipulate data calling collect_and_normalize() load data memory. example, filter data include births Canada overall irrespective gender use following code: One difference just calling get_cansim() data cached sessions ‘CANSIM_CACHE_PATH’ environment variable set. Typically set .Renviron file home directory share cache sessions projects. set_cansim_cache_path() function can used set cache path environment variable optionally install permanently .Renviron file. function emit warning package query cached newer version available StatCan. Setting refresh = \"auto\" argument automatically refresh data newer version available, setting refresh = TRUE forces refresh irrespective cached data date . approach especially useful working large tables, see example usage workflow Working large tables vignette.","code":"births <- get_cansim_connection(\"17-10-0016\") |> collect_and_normalize() births <- get_cansim_connection(\"17-10-0016\") |> dplyr::filter(GEO == \"Canada\", Gender == \"Total - gender\") |> collect_and_normalize()"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"bilingual","dir":"","previous_headings":"","what":"Bilingual","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Statistics Canada data tables provided either English French formats, including labels formats. cansim package allows download tables either English French. optional language argument retrieve tables French: Le paquet cansim fonctionne en anglais ou en français. Il existe un argument de langue optionnel pour récupérer les tables en français:","code":"naissances <- get_cansim(\"051-0013\",language=\"fr\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"normalizing-values","dir":"","previous_headings":"","what":"Normalizing values","title":"Retrieve and work with public Statistics Canada data tables in R","text":"package also scales variables reported thousands millions. Statistics Canada data table values may scaled powers 10. example, values VALUE field may reported “millions”, VALUE 10 means 10,000,000. default cansim package adds val_norm column scaled values, get value val_norm VALUE column converted 10 10,000,000 example given. Similarly, percentages converted rates, instead 0-100 normalized 0-1 val_norm column.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"vectors","dir":"","previous_headings":"","what":"Vectors","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Many time-series data available Statistics Canada individual vector codes users Canadian statistical data, often concerned specific time series CPI international arrivals, typically know exact series need. , example, tracking Canadian Consumer Price Index (CPI) time, might already know Statistics Canada vector code seasonally-unadjusted -items CPI value: v41690973. retrieve just data series without additional data available related tables, can use get_cansim_vector() function vector code date onward want get vector results . access metadata vectors, use detailed usage examples available Retrieving individual Statistics Canada vectors vignette.","code":"get_cansim_vector(\"v41690973\",\"2015-01-01\") get_cansim_vector_info(\"v41690973\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"table-overview-metadata","dir":"","previous_headings":"","what":"Table overview metadata","title":"Retrieve and work with public Statistics Canada data tables in R","text":"get_cansim_table_overview function displays overview table information. table yet downloaded cached first download table . Let’s take look ’s table interested .","code":"get_cansim_table_overview(\"36-10-040\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"listing-available-tables","dir":"","previous_headings":"","what":"Listing available tables","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Calling list_cansim_cubes returns data frame useful metadata available tables. 21 fields metadata table including title, English French, keyword sets, notes, table numbers. appropriate table can found subsetting filtering properties want use find appropriate tables. work well standard dplyr verbs. Retrieving table list takes little bit time, results cached duration session. sessions span several days refresh=TRUE argument can passed regenerate list capture newly published tables. Listing Statistics Canada data tables vignette additional detail examples.","code":"list_cansim_cubes() list_cansim_cubes() %>% filter(grepl(\"Labour force characteristics\",cubeTitleEn), grepl(\"economic region\",cubeTitleEn)) %>% select(\"cansim_table_number\",\"cubeTitleEn\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Retrieve and work with public Statistics Canada data tables in R","text":"code package licensed MIT license. Statistics Canada data retrieved using package made available Statistics Canada Open Licence Agreement, copy included inst folder. Statistics Canada Open Licence Agreement requires :","code":"Subject to this agreement, Statistics Canada grants you a worldwide, royalty-free, non-exclusive licence to: - use, reproduce, publish, freely distribute, or sell the Information; - use, reproduce, publish, freely distribute, or sell Value-added Products; and, - sublicence any or all such rights, under terms consistent with this agreement. In doing any of the above, you shall: - reproduce the Information accurately; - not use the Information in a way that suggests that Statistics Canada endorses you or your use of the Information; - not misrepresent the Information or its source; - use the Information in a manner that does not breach or infringe any applicable laws; - not merge or link the Information with any other databases for the purpose of attempting to identify an individual person, business or organization; and - not present the Information in such a manner that gives the appearance that you may have received, or had access to, information held by Statistics Canada about any identifiable individual person, business or organization."},{"path":"https://mountainmath.github.io/cansim/index.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Subject Statistics Canada Open Licence Agreement, licensed products using Statistics Canada data employ following acknowledgement source:","code":"Acknowledgment of Source (a) You shall include and maintain the following notice on all licensed rights of the Information: - Source: Statistics Canada, name of product, reference date. Reproduced and distributed on an \"as is\" basis with the permission of Statistics Canada. (b) Where any Information is contained within a Value-added Product, you shall include on such Value-added Product the following notice: - Adapted from Statistics Canada, name of product, reference date. This does not constitute an endorsement by Statistics Canada of this product."},{"path":"https://mountainmath.github.io/cansim/index.html","id":"why-cansim","dir":"","previous_headings":"","what":"Why cansim?","title":"Retrieve and work with public Statistics Canada data tables in R","text":"CANSIM name Statistics Canada’s legacy socio-economic data repository widely used practitioners, academics, students, many still calling new repository name. Statistics Canada refers current repository simply “Statistics Canada data” “StatCan data”. use CANSIM name package nostalgic reference.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"proxy-issues","dir":"","previous_headings":"","what":"Proxy issues","title":"Retrieve and work with public Statistics Canada data tables in R","text":"users reported issues accessing downloading Statistics Canada tables behind proxy sometimes case office environments. quick fix requires specifying proxy configuration httr package.","code":"httr::set_config(use_proxy(url=http_proxy, port=selected_port, username=your_username,password=your_pass))"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Issues pull requests highly appreciated. want get touch, pretty good responding via email via twitter @dshkol @vb_jens.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"related-packages","dir":"","previous_headings":"","what":"Related packages","title":"Retrieve and work with public Statistics Canada data tables in R","text":"statcanR package alternative package providing basic access StatCan NDM tables data discovery. cancensus package designed access, retrieve, work Canadian Census data geography. cansim package designed work conjunction cancensus data can easily joined standard geographic identifiers exposed harmonized packages. cmhc package designed access, retrieve, work CMHC data.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"cite-cansim","dir":"","previous_headings":"","what":"Cite cansim","title":"Retrieve and work with public Statistics Canada data tables in R","text":"wish cite cansim package work: von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions convenience tools accessing Statistics Canada data tables. v0.4.4. DOI: 10.32614/CRAN.package.cansim BibTeX entry LaTeX users ","code":"@Manual{cansim, author = {Jens {von Bergmann} and Dmitry Shkolnik}, title = {cansim: functions and convenience tools for accessing Statistics Canada data tables}, year = {2025}, doi = {10.32614/CRAN.package.cansim}, note = {R package version 0.4.4}, url = {https://mountainmath.github.io/cansim/} }"},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"Retrieves vector information given table coordinates. can used query data vectors, returns vector information coordinates present data table, gives effective way filter coordinates. Vector information available census data tables.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"","code":"add_cansim_vectors_to_template(template, refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"template (possibly filtered) cansim table template returned `get_cansim_table_template` refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"tibble containing table template added vector information","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"","code":"if (FALSE) { # \\dontrun{ template <- get_cansim_table_template(\"34-10-0013\") template |> filter(Geography==\"Canada\") |> add_cansim_vectors_to_template() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":null,"dir":"Reference","previous_headings":"","what":"Add provincial abbreviations as factor — add_provincial_abbreviations","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"Add provincial abbreviations factor","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"","code":"add_provincial_abbreviations(data)"},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"data tibble returned get_cansim provincial level data","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"input tibble additional factor GEO.abb contains language-specific provincial abbreviations","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"","code":"if (FALSE) { # \\dontrun{ df <- get_cansim(\"17-10-0005\") df <- add_provincial_abbreviations(df) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"Returns NDM table catalogue equivalent given standard old-format CANSIM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"","code":"cansim_old_to_new(oldCansimTableNumber)"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"oldCansimTableNumber deprecated style CANSIM table number (e.g. \"427-0001\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"character string new-format NDM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"","code":"cansim_old_to_new(\"026-0018\") #> [1] \"34-10-0013\""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"Repartitions already downloaded cached parquet feather dataset","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"","code":"cansim_repartition_cached_table( cansimTableNumber, new_partitioning = c(), language = \"english\", format = \"parquet\", cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"cansimTableNumber NDM table number load new_partitioning (Optional) Partition columns use parquet feather formats. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored format (Optional) format data table retrieve. Either \"parquet\", \"feather\", sqlite (default \"parquet\"). cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv(\"CANSIM_CACHE_PATH\")`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"","code":"if (FALSE) { # \\dontrun{ cansim_repartition_cached_table(\"34-10-0013\",new_partitioning=c(\"GeoUID\")) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":null,"dir":"Reference","previous_headings":"","what":"Use metadata to extract categories for column of specific level — categories_for_level","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"tables data hierarchical categories, metadata containing hierarchy level descriptions used extract categories specified level hierarchy .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"","code":"categories_for_level( data, column_name, level = NA, strict = FALSE, remove_duplicates = TRUE )"},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"data data table object returned get_cansim() column_name quoted name column extract categories level hierarchy level depth extract categories, 0 top category strict (default FALSE) TRUE extract specific hierarchy level remove_duplicates (default TRUE) set TRUE higher level grouping categories already captured lower level hierarchy data removed","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"vector categories","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"","code":"if (FALSE) { # \\dontrun{ data <- get_cansim(\"16-10-0117\") categories_for_level(data,\"North American Industry Classification System (NAICS)\",level=2) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":null,"dir":"Reference","previous_headings":"","what":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"Collect data parquet, feather sqlite query normalize cansim table output","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"","code":"collect_and_normalize( connection, replacement_value = \"val_norm\", normalize_percent = TRUE, default_month = \"07\", default_day = \"01\", factors = TRUE, strip_classification_code = FALSE, disconnect = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"connection connection local arrow connection returned get_cansim_connection, possibly filters dplyr verbs applied replacement_value (Optional) name column manipulated value returned . Defaults adding `val_norm` value field. normalize_percent (Optional) true (default) normalizes percentages changing rates default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\") factors (Optional) Logical value indicating dimensions converted factors. (Default set FALSE). strip_classification_code (Optional) Logical value indicating classification code stripped names. (Default set false). disconnect (Optional) used format sqlite. Logical value indicate SQLite database connection disconnected. (Default FALSE)","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"tibble collected normalized data","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"","code":"if (FALSE) { # \\dontrun{ library(dplyr) con <- get_cansim_connection(\"34-10-0013\") data <- con %>% filter(GEO==\"Ontario\") %>% collect_and_normalize() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":null,"dir":"Reference","previous_headings":"","what":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"correspondence file old new StatCan table numbers included package","code":""},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"https://www.statcan.gc.ca/eng/developers-developpeurs/cansim_id-product_id-concordance.csv","code":""},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"Statistics Canada","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":null,"dir":"Reference","previous_headings":"","what":"create database index — create_index","title":"create database index — create_index","text":"create database index","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create database index — create_index","text":"","code":"create_index(connection, table_name, field)"},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create database index — create_index","text":"connection connection database table_name sql table name field name field index","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create database index — create_index","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":null,"dir":"Reference","previous_headings":"","what":"convert csv to arrow — csv2arrow","title":"convert csv to arrow — csv2arrow","text":"convert csv arrow","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert csv to arrow — csv2arrow","text":"","code":"csv2arrow( csv_file, arrow_file, format = \"parquet\", col_names, value_column = \"VALUE\", partitioning = c(), na = c(NA, \"..\", \"\", \"...\", \"F\"), repair_columns = c(), text_encoding = \"UTF-8\", delim = \",\" )"},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert csv to arrow — csv2arrow","text":"csv_file input csv path arrow_file output arrow database path format format arrow file, \"parquet\" \"feather\" (default parquet) col_names column names csv file value_column name value column numeric data partitioning optional partition columns na na character strings repair_columns columns whose values repaired non-breaking spaces control characters writing, usually dimension columns text_encoding encoding csv file (default UTF-8) delim (Optional) csv deliminator, default \",\"","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"convert csv to arrow — csv2arrow","text":"database connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"convert csv sqlite adapted https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"","code":"csv2sqlite( csv_file, sqlite_file, table_name, transform = NULL, chunk_size = 5e+06, append = FALSE, col_types = NULL, na = c(NA, \"..\", \"\", \"...\", \"F\"), text_encoding = \"UTF-8\", delim = \",\", ... )"},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"csv_file input csv path sqlite_file output sql database path table_name sql table name transform optional function transforms chunk chunk_size optional chunk size read/write data, default=1,000,000 append optional parameter, append database overwrite, default=`FALSE` col_types optional parameter csv column types na na character strings text_encoding encoding csv file (default UTF-8) delim (Optional) csv deliminator, default \",\" ... (Optional) additional parameters passed `readr::read_delim_chunked`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"database connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","title":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","text":"Disconnect cansim database connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","text":"","code":"disconnect_cansim_sqlite(connection)"},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","text":"connection connection database","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disconnect from a cansim database connection — disconnect_cansim_sqlite","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_sqlite(\"34-10-0013\") disconnect_cansim_sqlite(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":null,"dir":"Reference","previous_headings":"","what":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"Fold metadata selected columns","code":""},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"","code":"fold_in_metadata_for_columns(data, data_path, column_names)"},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"data tibble StatCan table data e.g. returned get_cansim. data_path base path save parsed metadata column_names names columns","code":""},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"tibble including metadata information","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"Retrieves data table using NDM catalogue number tidy data frame. Retrieved table data cached duration current R session default.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"","code":"get_cansim( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\") Set higher values large tables slow network connection. (Default 200).","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"tibble StatCan Table data added Date column inferred date objects added val_norm column normalized value VALUE column. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"","code":"if (FALSE) { # \\dontrun{ get_cansim(\"34-10-0013\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"Retrieve list tables modified updated since specified date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"","code":"get_cansim_changed_tables(start_date, end_date = NULL)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"start_date Starting date YYYY-MM-DD format look changes changed date end_date Optional end date YYYY-MM-DD format look changes changed date, default start date","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"tibble Statistics Canada data table product ids release times Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"","code":"# \\donttest{ get_cansim_changed_tables(\"2018-08-01\") #> # A tibble: 8 × 2 #> productId releaseTime #> #> 1 23100251 2018-08-01T08:35 #> 2 33100036 2018-08-01T08:30 #> 3 10100139 2018-08-01T08:30 #> 4 10100125 2018-08-01T08:30 #> 5 10100107 2018-08-01T08:30 #> 6 33100005 2018-08-01T08:30 #> 7 33100033 2018-08-01T08:30 #> 8 33100084 2018-08-01T08:30 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":null,"dir":"Reference","previous_headings":"","what":"Get NDM code sets — get_cansim_code_set","title":"Get NDM code sets — get_cansim_code_set","text":"Useful get list surveys subjects used internally","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get NDM code sets — get_cansim_code_set","text":"","code":"get_cansim_code_set( code_set = c(\"scalar\", \"frequency\", \"symbol\", \"status\", \"uom\", \"survey\", \"subject\", \"wdsResponseStatus\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get NDM code sets — get_cansim_code_set","text":"code_set code set retrieve. refresh Default FALSE, repeated calls session hit cached data. refresh code list running R session set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get NDM code sets — get_cansim_code_set","text":"tibble english french labels given code set Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get NDM code sets — get_cansim_code_set","text":"","code":"# \\donttest{ get_cansim_code_set(\"survey\") #> # A tibble: 900 × 3 #> surveyCode surveyEn surveyFr #> #> 1 1105 Business Register Registr… #> 2 1141 Average Fair Market Value/Purchase Price for New Homes i… Juste v… #> 3 1209 Survey of Environmental Goods and Services Enquête… #> 4 1301 Gross Domestic Product by Industry - National (Monthly) Produit… #> 5 1302 Gross Domestic Product by Industry - Annual Produit… #> 6 1303 Gross Domestic Product by Industry - Provincial and Terr… Produit… #> 7 1401 Supply, Use and Input-Output Tables Tableau… #> 8 1402 Productivity Measures and Related Variables - National a… Mesures… #> 9 1529 Capital Invested Abroad by Canadian Enterprises Capitau… #> 10 1530 Capital Invested in secondary foreign companies by Canad… Capitau… #> # ℹ 890 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"Returns table column details given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"","code":"get_cansim_column_categories( cansimTableNumber, column, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"cansimTableNumber NDM table number load column specified column retrieve category information language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"tibble detailed information StatCan table categories specified field Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"","code":"# \\donttest{ get_cansim_column_categories(\"34-10-0013\", \"Geography\") #> # A tibble: 50 × 7 #> `Dimension ID` `Dimension name` `Member ID` `Member Name` `Parent Member ID` #> #> 1 1 Geography 1 Canada NA #> 2 1 Geography 2 Newfoundland … 1 #> 3 1 Geography 3 Prince Edward… 1 #> 4 1 Geography 4 Nova Scotia 1 #> 5 1 Geography 5 New Brunswick 1 #> 6 1 Geography 6 Quebec 1 #> 7 1 Geography 7 Ontario 1 #> 8 1 Geography 8 Manitoba 1 #> 9 1 Geography 9 Saskatchewan 1 #> 10 1 Geography 10 Alberta 1 #> # ℹ 40 more rows #> # ℹ 2 more variables: Terminated , Hierarchy # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table column list — get_cansim_column_list","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"Returns table column details given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"","code":"get_cansim_column_list( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"tibble listing column names StatCan table. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"","code":"# \\donttest{ get_cansim_column_list(\"34-10-0013\") #> # A tibble: 2 × 2 #> `Dimension ID` `Dimension name` #> #> 1 1 Geography #> 2 2 Type of property # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"Retrieves data table using NDM catalogue number parquet, feather, SQLite database connection. Retrieved table data cached permanently cache path supplied duration current R session. table cached function check newer version available emit warning message cached table date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"","code":"get_cansim_connection( cansimTableNumber, language = \"english\", format = \"parquet\", partitioning = c(), refresh = FALSE, timeout = 1000, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored format (Optional) format data table retrieve. Either \"parquet\", \"feather\", sqlite (default \"parquet\"). partitioning (Optional) Partition columns use parquet feather formats. refresh (Optional) Valid options FALSE (default), TRUE, \"auto\". set TRUE, forces reload data table, set \"auto\" refresh table downloading newest version StatCan table date. set FALSE table date warning emitted alert user data outdated. timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv('CANSIM_CACHE_PATH')`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"database connection local parquet, feather, sqlite database StatCan Table data. data frames calling `collect()` `collect_and_normalize()` identical possibly different row order. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\") # Work with the data connection glimpse(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"Retrieves table metadata given input table number vector table numbers using either new old table number format. Patience suggested Statistics Canada API can slow. `list_cansim_tables()` function can used alternative retrieve (cached) list CANSIM tables (limited) metadata.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"","code":"get_cansim_cube_metadata(cansimTableNumber, type = \"overview\", refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"cansimTableNumber new old CANSIM/NDM table number vector table numbers type type metadata get, options \"overview\", \"members\", \"notes\", \"corrections\". refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"tibble containing table metadata. several table numbers given, metadata tables retrieved single API call results stacked. Types \"overview\" carry table identifier , `cansimTableNumber` column added identify table. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"","code":"# \\donttest{ get_cansim_cube_metadata(\"34-10-0013\") #> # A tibble: 1 × 17 #> responseStatusCode productId cansimId cubeTitleEn cubeTitleFr cubeStartDate #> #> 1 0 34-10-0013 026-0018 Residential … Valeurs de… 2005-01-01 #> # ℹ 11 more variables: cubeEndDate , frequencyCode , #> # nbSeriesCube , nbDatapointsCube , releaseTime , #> # archiveStatusCode , archiveStatusEn , archiveStatusFr , #> # subjectCode , surveyCode , issueDate # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"Allows retrieval data Statistics Canada data table specific table coordinates. allows partial targeted download tables can effectively combined get_cansim_table_template function help pinpoint data series interest. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"","code":"get_cansim_data_for_table_coord_periods( tableCoordinates, periods = NULL, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"tableCoordinates Either list vectors coordinates table number, (filtered) data frame returned get_cansim_table_template. periods Optional numeric value number latest periods retrieve data , default NULL case data periods downloaded. Alternatively can specified coordinate tableCoordinates data frame, argument ignored data frame \"periods\" column. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"tibble data matching specified coordinate period input arguments Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"","code":"# \\donttest{ get_cansim_data_for_table_coord_periods(list(\"35-10-0003\"=c(\"1.1\",\"1.12\")),periods=3) #> Accessing CANSIM NDM coordinates from Statistics Canada #> # A tibble: 6 × 17 #> REF_DATE Date GEO REF_DATE_2 Custodial and commun…¹ VALUE val_norm #> #> 1 2021-01-01 2021-01-01 Newfou… 2022-01-01 Total actual-in count 2.1 2.1 #> 2 2022-01-01 2022-01-01 Newfou… 2023-01-01 Total actual-in count 1.8 1.8 #> 3 2023-01-01 2023-01-01 Newfou… 2024-01-01 Total actual-in count NA NA #> 4 2021-01-01 2021-01-01 Newfou… 2022-01-01 Probation rate per 10… 29.1 29.1 #> 5 2022-01-01 2022-01-01 Newfou… 2023-01-01 Probation rate per 10… 19.4 19.4 #> 6 2023-01-01 2023-01-01 Newfou… 2024-01-01 Probation rate per 10… 16.7 16.7 #> # ℹ abbreviated name: ¹​`Custodial and community supervision` #> # ℹ 10 more variables: UOM , UOM_ID , SCALAR_ID , VECTOR , #> # cansimTableNumber , COORDINATE , SYMBOL , releaseTime , #> # frequencyCode , DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":null,"dir":"Reference","previous_headings":"","what":"Major economic indicator release schedule — get_cansim_key_release_schedule","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"Returns every release date major economic indicators since March 14, 2012. also includes scheduled future releases.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"","code":"get_cansim_key_release_schedule()"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"tibble data, details major economic indicator release Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"","code":"# \\donttest{ get_cansim_key_release_schedule() #> # A tibble: 2,881 × 5 #> date type title description url #> #> 1 2012-03-16 meeting Canada's international transactions in … \"January 2… /dai… #> 2 2012-03-16 meeting Monthly Survey of Manufacturing \"January 2… /dai… #> 3 2012-03-19 meeting Wholesale trade \"January 2… /dai… #> 4 2012-03-20 meeting Travel between Canada and other countri… \"\" /dai… #> 5 2012-03-22 meeting Retail trade \"January 2… /dai… #> 6 2012-03-23 meeting Consumer Price Index \"February … /dai… #> 7 2012-03-29 meeting Industrial product and raw materials pr… \"February … /dai… #> 8 2012-03-29 meeting National tourism indicators \"Fourth qu… /dai… #> 9 2012-03-30 meeting Gross domestic product by industry \"January 2… /dai… #> 10 2012-03-30 meeting Payroll employment, earnings and hours,… \"January 2… /dai… #> # ℹ 2,871 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"Retrieves series information coordinates","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"","code":"get_cansim_series_info_cube_coord( cansimTableNumber, coordinates, timeout = 1000, refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"cansimTableNumber new old CANSIM/NDM table number, coordinates specific single table coordinates vector coordinates timeout Timeout API call refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"tibble containing series information given coordinates Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"","code":"# \\donttest{ get_cansim_series_info_cube_coord(\"34-10-0013\", c(\"1.1.1.1.1.1\", \"2.1.1.1.1.1\")) #> # A tibble: 0 × 3 #> # ℹ 3 variables: productId , coordinate , vectorId # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"method deprecated removed future version, please use `get_cansim_connection(..., format=\"sqlite\")` instead. Retrieves data table using NDM catalogue number SQLite table. Retrieved table data cached permanently cache path supplied duration current R session. function check latest release data table emit warning message cached table date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"","code":"get_cansim_sqlite( cansimTableNumber, language = \"english\", refresh = FALSE, auto_refresh = FALSE, timeout = 1000, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) auto_refresh (Optional) set TRUE, reload data table new version available (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv('CANSIM_CACHE_PATH')`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"database connection local SQLite database StatCan Table data. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") # Work with the data connection glimpse(con) disconnect_cansim_sqlite(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table information — get_cansim_table_info","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"Returns table information given NDM table catalogue number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"","code":"get_cansim_table_info( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"tibble table overview information Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"","code":"# \\donttest{ get_cansim_table_info(\"34-10-0013\") #> # A tibble: 1 × 7 #> `Cube Title` `Product Id` `CANSIM Id` `Archive Status` Frequency #> #> 1 Residential property valu… 34-10-0013 026-0018 CURRENT - a cub… 12 #> # ℹ 2 more variables: `Start Reference Period` , #> # `End Reference Period` # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"can used check table last updated.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"","code":"get_cansim_table_last_release_date(cansimTableNumber)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"cansimTableNumber NDM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"datetime object release data available, NULL otherwise. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"","code":"# \\donttest{ get_cansim_table_last_release_date(\"34-10-0013\") #> [1] \"2018-05-09 12:30:00 UTC\" # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"Returns table notes given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"","code":"get_cansim_table_notes( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"tibble table notes. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"","code":"# \\donttest{ get_cansim_table_notes(\"34-10-0013\") #> # A tibble: 22 × 4 #> `Note ID` Note `Dimension name` `Member Name` #> #> 1 1 \"The methodology used in the curren… NA NA #> 2 2 \"Changes occurred in census metropo… Geography Québec, Queb… #> 3 2 \"Changes occurred in census metropo… Geography Saguenay, Qu… #> 4 2 \"Changes occurred in census metropo… Geography Sherbrooke, … #> 5 2 \"Changes occurred in census metropo… Geography Trois-Rivièr… #> 6 2 \"Changes occurred in census metropo… Geography Guelph, Onta… #> 7 2 \"Changes occurred in census metropo… Geography Ottawa-Gatin… #> 8 2 \"Changes occurred in census metropo… Geography Gatineau part #> 9 2 \"Changes occurred in census metropo… Geography Kelowna, Bri… #> 10 2 \"Changes occurred in census metropo… Geography Abbotsford-M… #> # ℹ 12 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"Prints table overview information console output. order display table overview information, selected CANSIM table must loaded entirely display overview information. Overview information printed console English French, specified.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"","code":"get_cansim_table_overview( cansimTableNumber, language = \"english\", refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE)","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"none Nothing printed data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"","code":"# \\donttest{ get_cansim_table_overview(\"34-10-0013\") #> Residential property values #> CANSIM Table 34-10-0013 #> Start Reference Period: 2005-01-01, End Reference Period: 2015-01-01, Frequency: 12 #> #> Column Geography (50) #> Canada, Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, ... #> #> Column Type of property (1) #> Residential # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"Returns table notes given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"","code":"get_cansim_table_short_notes( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"tibble StatCan Notes table Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"","code":"# \\donttest{ get_cansim_table_short_notes(\"34-10-0013\") #> # A tibble: 3 × 2 #> `Note ID` Note #> #> 1 1 \"The methodology used in the current release differs from that used… #> 2 2 \"Changes occurred in census metropolitan area geographical boundari… #> 3 3 \"Changes occurred in census metropolitan area geographical boundari… # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"Returns table subject detail given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"","code":"get_cansim_table_subject( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"tibble table subject code name. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"","code":"# \\donttest{ get_cansim_table_subject(\"34-10-0013\") #> # A tibble: 2 × 1 #> `Subject Code` #> #> 1 3406 #> 2 4602 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"Returns table survey detail given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"","code":"get_cansim_table_survey( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"tibble table survey code name Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"","code":"# \\donttest{ get_cansim_table_survey(\"34-10-0013\") #> # A tibble: 1 × 1 #> `Survey Code` #> #> 1 5213 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve table template from Statistics Canada API — get_cansim_table_template","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"table template consists dimensions members coordinates table can used explore filter table data downloading subsets table. add vector Ids (possibly filtered) template `add_cansim_vectors_to_template` function can used.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"","code":"get_cansim_table_template( cansimTableNumber, language = \"english\", refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"cansimTableNumber new old CANSIM/NDM table number vector table numbers language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"tibble containing table template, `cansimTableNumber` column identifying table. several table numbers given, templates stacked columns dimensions appear tables filled `NA` tables. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"","code":"# \\donttest{ get_cansim_table_template(\"34-10-0013\") #> # A tibble: 50 × 4 #> cansimTableNumber COORDINATE Geography `Type of property` #> #> 1 34-10-0013 1.1 Canada Residential #> 2 34-10-0013 2.1 Newfoundland and Labrador Residential #> 3 34-10-0013 3.1 Prince Edward Island Residential #> 4 34-10-0013 4.1 Nova Scotia Residential #> 5 34-10-0013 5.1 New Brunswick Residential #> 6 34-10-0013 6.1 Quebec Residential #> 7 34-10-0013 7.1 Ontario Residential #> 8 34-10-0013 8.1 Manitoba Residential #> 9 34-10-0013 9.1 Saskatchewan Residential #> 10 34-10-0013 10.1 Alberta Residential #> # ℹ 40 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"Retrieve URL table API given table number. Offers stable approach manually guessing URL table.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"","code":"get_cansim_table_url(cansimTableNumber, language = \"english\")"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"String object containing URL specified table number Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"","code":"# \\donttest{ get_cansim_table_url(\"34-10-0013\") #> [1] \"https://www150.statcan.gc.ca/n1/tbl/csv/34100013-eng.zip\" get_cansim_table_url(\"34-10-0013\", language = \"fr\") #> [1] \"https://www150.statcan.gc.ca/n1/tbl/csv/34100013-fra.zip\" # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"Allows retrieval data specified vector series given time window. Accessing data vector allows targeted extraction time series. Discovering vectors interest can achieved using StatCan table web interface using get_cansim_table_template function help pinpoint data series interest, chaining add_cansim_vectors_to_template function add cansim vector information template data. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"","code":"get_cansim_vector( vectors, start_time = as.Date(\"1800-01-01\"), end_time = Sys.time(), use_ref_date = TRUE, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"vectors list vectors retrieve start_time Starting date YYYY-MM-DD format, applies REF_DATE releaseTime, depending use_ref_date parameter end_time Set optional end time filter YYYY-MM-DD format (defaults current system time) use_ref_date Optional, TRUE default. set TRUE, uses REF_DATE vector data filter, otherwise uses StatisticsCanada's releaseDate value filtering specified vectors. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"tibble data vectors released start end time Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"","code":"# \\donttest{ get_cansim_vector(\"v41690973\",\"2015-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 138 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2015-01-… 2015-01-01 Cana… All-items 124. 124. 2002… 17 #> 2 2015-02-… 2015-02-01 Cana… All-items 125. 125. 2002… 17 #> 3 2015-03-… 2015-03-01 Cana… All-items 126. 126. 2002… 17 #> 4 2015-04-… 2015-04-01 Cana… All-items 126. 126. 2002… 17 #> 5 2015-05-… 2015-05-01 Cana… All-items 127. 127. 2002… 17 #> 6 2015-06-… 2015-06-01 Cana… All-items 127. 127. 2002… 17 #> 7 2015-07-… 2015-07-01 Cana… All-items 127. 127. 2002… 17 #> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 #> # ℹ 128 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"Allows retrieval data specified vector series N -recently released periods. Accessing data vector allows targeted extraction time series. Discovering vectors interest can achieved using StatCan table web interface using get_cansim_table_template function help pinpoint data series interest, chaining add_cansim_vectors_to_template function add cansim vector information template data. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"","code":"get_cansim_vector_for_latest_periods( vectors, periods = NULL, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"vectors list vectors retrieve periods Numeric value number latest periods retrieve data , default data retrieved. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Timeout seconds downloading cansim table work around scenarios StatCan servers drop network connection. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"tibble data specified vector(s) last N periods Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"","code":"# \\donttest{ get_cansim_vector_for_latest_periods(\"v41690973\",10) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 10 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2025-09-… 2025-09-01 Cana… All-items 165. 165. 2002… 17 #> 2 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 #> 3 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 #> 4 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 #> 5 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 #> 6 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 #> 7 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 #> 8 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 #> 9 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 #> 10 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"Allows retrieval metadata Statistics Canada data vectors","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"","code":"get_cansim_vector_info(vectors)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"vectors vector cansim vectors","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"tibble metadata selected vectors Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"","code":"# \\donttest{ get_cansim_vector_info(\"v41690973\") #> # A tibble: 1 × 10 #> DECIMALS VECTOR table COORDINATE title_en title_fr UOM frequencyCode #> #> 1 1 v41690973 18-10-0004 2.2 Canada;… Canada;… 17 6 #> # ℹ 2 more variables: SCALAR_ID , title # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"Get column names de-duplicated correct order","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"","code":"get_deduped_column_level_data(cansimTableNumber, language, column)"},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"cansimTableNumber table number language language column names column column name","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"tibble column names","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"List cached cansim arrow SQlite databases","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"","code":"list_cansim_cached_tables( cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`. refresh Optional, refresh last updated date cached cansim tables","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"tibble list tables currently cached given cache path.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cached_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":null,"dir":"Reference","previous_headings":"","what":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"Generates overview table containing metadata available Statistics Canada data cubes.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"","code":"list_cansim_cubes(lite = FALSE, refresh = FALSE, quiet = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"lite Get version without cube dimensions comments faster retrieval, default FALSE. refresh Default FALSE, repeated calls session hit cached data. quiet Optional, suppress messages refresh code list running R session set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"tibble available Statistics Canada data cubes, including NDM table number, cube title, start end dates, achieve status, subject survey codes, frequency codes list cube dimensions. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cubes() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"method deprecated removed future version, please use `list_cansim_cached_tables()` instead.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"","code":"list_cansim_sqlite_cached_tables( cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`. refresh Optional, refresh last updated date cached cansim tables","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"tibble list tables currently cached given cache path.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cached_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"method deprecated, please use `list_cansim_cubes` instead. Generates overview table containing metadata available Statistics Canada data tables. new updated table generated table already exist cached form force refresh option selected (set FALSE default). can take time process involves scraping hundreds Statistics Canada web pages gather required metadata. option cansim.cache_path set look store overview table directory.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"","code":"list_cansim_tables(refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"refresh Default FALSE, regenerate table set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"tibble available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description, geography Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":null,"dir":"Reference","previous_headings":"","what":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"Facilitates working Statistics Canada data table values retrieved using package setting units counts/dollars instead millions, etc. \"replacement_value\" set, replace VALUE field normalized values drop scale column. Otherwise keep scale columns create new column named replacement_value normalized value. attempt parse REF_DATE field create R date variable. currently experimental.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"","code":"normalize_cansim_values( data, replacement_value = \"val_norm\", normalize_percent = TRUE, default_month = \"01\", default_day = \"01\", factors = TRUE, strip_classification_code = FALSE, cansimTableNumber = NULL, internal = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"data retrieved data table returned get_cansim() get_cansim_ndm() replacement_value (Optional) name column manipulated value returned . Defaults \"val_norm\" normalize_percent (Optional) TRUE (default) normalizes percentages changing rates default_month default month used creating Date objects annual data (default set \"01\") default_day default day month used creating Date objects monthly data (default set \"01\") factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). strip_classification_code Logical value indicating classification code stripped names. (Default set FALSE, factors=TRUE overridden set TRUE). cansimTableNumber (Optional) needed operating results SQLite connections. internal (Optional) Flag indicate function called internally.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"Returns tibble adjusted values.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"","code":"if (FALSE) { # \\dontrun{ cansim_table <- get_cansim(\"34-10-0013\") normalize_cansim_values(cansim_table) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse metadata — parse_metadata","title":"Parse metadata — parse_metadata","text":"Parse metadata","code":""},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse metadata — parse_metadata","text":"","code":"parse_metadata(meta, data_path)"},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse metadata — parse_metadata","text":"meta raw metadata table data_path base path save parsed metadata","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"Remove cached cansim SQLite parquet database","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"","code":"remove_cansim_cached_tables( cansimTableNumber, format = c(\"parquet\", \"feather\", \"sqlite\"), language = NULL, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"cansimTableNumber Vector table(s) removed, (filtered) table returned `list_cansim_cached_tables` list tables removed. format Format cache remove, possible values `\"parquet\"`, `\"feather\"` `\"sqlite\"` subset (default ) language Language remove cached data, named get_cansim(). unspecified (`NULL`) tables languages removed. cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"parquet\") remove_cansim_cached_tables(\"34-10-0013\", format=\"parquet\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"method deprecated removed future version, please use `remove_cansim_cached_tables(..., format=\"sqlite\")` instead.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"","code":"remove_cansim_sqlite_cached_table( cansimTableNumber, language = NULL, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"cansimTableNumber Number table removed language Language remove cached data, named get_cansim(). unspecified (`NULL`) tables languages removed cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") disconnect_cansim_sqlite(con) remove_cansim_cached_tables(\"34-10-0013\", format=\"sqlite\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":null,"dir":"Reference","previous_headings":"","what":"Search through Statistics Canada data cubes — search_cansim_cubes","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"Searches Statistics Canada data cubes using search term.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"","code":"search_cansim_cubes(search_term, refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"search_term User-supplied search term used find Statistics Canada data cubes matching titles, table numbers, subject survey codes. refresh Default FALSE. underlying cube list cached duration R sessions regenerate cube list set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"tibble available Statistics Canada data cubes, listing title, Statistics Canada data cube catalogue number, deprecated CANSIM table number, survey subject. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"","code":"if (FALSE) { # \\dontrun{ search_cansim_cubes(\"Labour force\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"method deprecated, please use `search_cansim_cubes` instead. Searches Statistics Canada data tables using search term. new table generated already exist refresh option set TRUE. Search-terms case insensitive, accept regular expressions advanced searching. search function can search either table titles table descriptions, depending whether search_description set TRUE . refresh = TRUE, table updated regenerated using Statistics Canada's latest data. can take time since process involves scraping several hundred web pages gather required metadata. option cache_path set look store overview table directory.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"","code":"search_cansim_tables(search_term, search_fields = \"both\", refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"search_term User-supplied search term used find Statistics Canada data tables matching titles search_fields default, function search table titles keywords. Setting parameter \"title\" search title, setting \"keyword\" search keywords refresh Default FALSE, regenerate table set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"tibble available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description geography match search term. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"","code":"if (FALSE) { # \\dontrun{ search_cansim_tables(\"Labour force\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Set persistent cansim cache location — set_cansim_cache_path","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"Cansim provides session caching retrieved data. function create persistent cache across sessions data accessed via `get_cansim_connection` caches data database across sessions..","code":""},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"","code":"set_cansim_cache_path(cache_path, overwrite = FALSE, install = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"cache_path local directory use saving cached data overwrite Option overwrite existing cache path already stored locally. install Option install permanently use across sessions.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"","code":"if (FALSE) { # \\dontrun{ set_cansim_cache_path(\"~/cansim_cache\") # This will set the cache path permanently until overwritten again set_cansim_cache_path(\"~/cancensus_cache\", install = TRUE) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":null,"dir":"Reference","previous_headings":"","what":"View saved cache directory path — show_cansim_cache_path","title":"View saved cache directory path — show_cansim_cache_path","text":"View saved cache path'","code":""},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"View saved cache directory path — show_cansim_cache_path","text":"","code":"show_cansim_cache_path()"},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"View saved cache directory path — show_cansim_cache_path","text":"","code":"show_cansim_cache_path() #> [1] \"/Users/jens/data/cansim.data\""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":null,"dir":"Reference","previous_headings":"","what":"View CANSIM table or vector information in browser — view_cansim_webpage","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"Opens CANSIM table vector Statistics Canada's website using default browser. may useful getting info CANSIM table survey methods.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"","code":"view_cansim_webpage(cansimTableNumber = NULL)"},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"cansimTableNumber CANSIM NDM table number cansim vectors \"v\" prefix. number provided, vector search page Statistic Canada website opened.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"none","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"","code":"if (FALSE) { # \\dontrun{ view_cansim_webpage(\"34-10-0013\") } # }"},{"path":[]},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-4-5","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.4.5","text":"StatCan unavailable longer aborts error. Timeouts, connection failures error responses now reported loud warning function returns NULL, script document can decide servers . applies every function talks StatCan, also covers two calls previously bypassed retry helper, get_cansim_table_last_release_date() get_cansim_series_info_cube_coord(). Set options(cansim.error_on_unavailable=TRUE) get previous behaviour raising error examples make single lightweight API call now \\donttest{} rather \\dontrun{}, checked rather merely displayed. Examples download full table cube list stay \\dontrun{} run time, cansim_old_to_new() needs network example now always runs data retrieved vector table/coordinate now carries UOM UOM_ID columns, taken cube metadata. StatCan flags single dimension cube carrying unit measure unit varies member dimension, unit resolved per coordinate. Tables unit measure, example census tables, get unit columns, matching full table download (#170) non-breaking spaces control characters names returned StatCan now replaced regular spaces. characters render ordinary space nothing , column whose name contained one reached typing copy-pasting console displayed. repair covers table downloads, vector coordinate calls, cube metadata, table templates cube list, emits warning shows offending characters code point, example Performance strategy, together count many names repaired. Set options(cansim.suppress_repair_warnings=TRUE) silence warning. warning also says characters data StatCan publishes rather anything user , disappear StatCan stops sending , pointing issue tracked. Column names tables cached release keep original characters table downloaded , get_cansim_connection() warns finds cache (#169) repair now also covers member labels data , just names columns holding . characters turn common member labels dimension names, 53 500 sampled tables carry least one. Repairing metadata side left labels data unable match factor levels, every row carrying affected label become NA. Labels now also identical whichever way data retrieved, table can joined template, vector coordinate data dimension columns (#169) internal scan_statcan_character_problems() reads cube metadata straight API, without repair applied, reports every title, dimension name member name StatCan publishes non-breaking space control character , table, level language. summarize_statcan_character_problems() aggregates survey. Neither exported, exist track whether upstream problem shrinking, go away along repair (#169) cached tables now record package version parsed alongside download timestamp, single .Rda_info file replaces .Rda_time file timestamp used . timestamp says whether StatCan newer data, version says whether release still reads files way. list_cansim_cached_tables() reports new cansimVersion column, empty anything cached release. old timestamp file still read, existing caches keep download date, replaced table refreshed. get_cansim_connection() uses version check whether cache predates repair non-breaking spaces control characters, reads metadata cached alongside table see whether dimension names member labels actually carry . warn, naming offending label pointing refresh=TRUE (#169)","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"deprecations-0-4-5","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"cansim 0.4.5","text":"get_cansim_sqlite(), list_cansim_sqlite_cached_tables() remove_cansim_sqlite_cached_table() now also documented deprecated, matching deprecation warnings already emit. Use get_cansim_connection(..., format=\"sqlite\"), list_cansim_cached_tables() remove_cansim_cached_tables(..., format=\"sqlite\") instead deprecated get_cansim_sqlite(), list_cansim_sqlite_cached_tables(), remove_cansim_sqlite_cached_table(), list_cansim_tables() search_cansim_tables() scheduled removal future release","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"performance-0-4-5","dir":"Changelog","previous_headings":"","what":"Performance","title":"cansim 0.4.5","text":"hierarchy building metadata parsing longer re-parses growing hierarchy paths, hierarchies built one ancestor level time across members coordinates split character matrix folding metadata converting factors factor conversion dimensions duplicate member names splits unique coordinates instead every row, table repeats coordinate per reference period. 36-10-0580 6,882 unique coordinates 996,978 rows, cutting cached read 4.5s 4.0s table templates built single cartesian product instead joining one dimension time metadata data retrieved vector table/coordinate now resolved coordinates . member table dimension used rebuilt every single coordinate, made step grow linearly 24ms per coordinate. Resolving 200 coordinates 36-10-0580 went 5.0s 0.02s, 10,164 coordinates table now take 0.03s. Warnings members missing cube metadata reported per member rather per coordinate uses ","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-5","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.5","text":"unrecognized language argument now error naming passed, instead NA travelled cache directory name tail StatCan URL surfaced later download failure missing column. Either language can named either language, \"english\", \"en\", \"eng\" \"anglais\" select English \"french\", \"fr\", \"fra\" \"français\" select French, along longer shorter forms; case, surrounding whitespace accents ignored. get_cansim_table_url() get_cansim_table_notes() now default \"english\" like every function takes language, selects language previous \"en\" default (#152) drop unreachable (TRUE) ... else ... metadata parsing. else branch held readr::read_delim() implementation utils::read.delim() replaced February 2025 since fallen behind live branch, longer working fallback (#151) fix case_when() deprecation warning emitted dplyr 1.2.0 every table read fix get_cansim_changed_tables() passing “days” difftime() time zone instead unit get_cansim_connection() longer fails release date table determined, staleness check skipped message instead unit measure columns French language tables now ordered value columns, already English language tables better connection error handling fix get_cansim_cube_metadata() get_cansim_table_template() vectors table numbers, metadata tables still retrieved single API call cached per table get_cansim_cube_metadata() adds cansimTableNumber column “members”, “notes” “corrections” types functions operate single table now fail informative message given several table numbers","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-044","dir":"Changelog","previous_headings":"","what":"cansim 0.4.4","title":"cansim 0.4.4","text":"CRAN release: 2025-08-19","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-4","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.4","text":"fix problem metadata parsing work properly table names make documentations consistent wrt default langauge names add convenience functions setting cache paths data accessed via get_cansim_connection","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-043","dir":"Changelog","previous_headings":"","what":"cansim 0.4.3","title":"cansim 0.4.3","text":"CRAN release: 2025-05-30","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.3","text":"better handling duplicated levels metadata, ignore duplication geography names census tables emit warning fix issue accessing tables without footnotes","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-042","dir":"Changelog","previous_headings":"","what":"cansim 0.4.2","title":"cansim 0.4.2","text":"CRAN release: 2025-05-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-2","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.2","text":"ensure proper ordering levels even StatCan metadata ordered better error messages information disable peer checking StatCan SSL certificates problems automatically batch vector coordinate data retrieval case users request 300 series time ## Major changes enable series information table coordinate generate table template facilitate adding vector info aid pinpointed data download enable downloading data vector multiple coordinates get_cansim_data_for_table_coord_periods (breaking changes change parameter)","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-041","dir":"Changelog","previous_headings":"","what":"cansim 0.4.1","title":"cansim 0.4.1","text":"CRAN release: 2025-03-15","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-1","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.1","text":"fix problem parsing census data tables fix problem converting factors classification codes attached.","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-04","dir":"Changelog","previous_headings":"","what":"cansim 0.4","title":"cansim 0.4","text":"CRAN release: 2025-02-24","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-4","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.4","text":"add support local caching parquet feather formats uniform interface sqlite, parquet, feather caching principled approach column order ## Minor changes fix problem inconsistent type parsing notes better support french language accessing data vector coordinate tests","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0317","dir":"Changelog","previous_headings":"","what":"cansim 0.3.17","title":"cansim 0.3.17","text":"CRAN release: 2024-11-06","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-17","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.17","text":"fix problem reading French tables released census division restore original column order converting factors convert geography column factor available fix problem add_provincial_abbreviations lead mislabelling provinces cases improve handling metadata, enable downloading metadata instead via full table download fold metadata data accessing via vector coordinates allow cansim vectors view_cansim_webpage view vector information statcan browser","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0316","dir":"Changelog","previous_headings":"","what":"cansim 0.3.16","title":"cansim 0.3.16","text":"CRAN release: 2024-03-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-16","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.16","text":"improve offline handling StatCan servers improve metadata handling Member ID order mixed metadata fix problem refreshing data get_cansim_vectors","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0315","dir":"Changelog","previous_headings":"","what":"cansim 0.3.15","title":"cansim 0.3.15","text":"CRAN release: 2023-10-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-15","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.15","text":"accommodate quirks table 98-10-0017","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0314","dir":"Changelog","previous_headings":"","what":"cansim 0.3.14","title":"cansim 0.3.14","text":"CRAN release: 2023-01-20","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-14","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.14","text":"Better header parsing avoid warning messages Fix problem semi-wide tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0313","dir":"Changelog","previous_headings":"","what":"cansim 0.3.13","title":"cansim 0.3.13","text":"CRAN release: 2022-11-07","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-13","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.13","text":"Speed access cached sqlite tables Fix problem get_cansim_vector_info()","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0312","dir":"Changelog","previous_headings":"","what":"cansim 0.3.12","title":"cansim 0.3.12","text":"CRAN release: 2022-07-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-12","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.12","text":"Fix bug causes collect_and_normalize function operating systems","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0311","dir":"Changelog","previous_headings":"","what":"cansim 0.3.11","title":"cansim 0.3.11","text":"CRAN release: 2022-05-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-11","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.11","text":"Support new semi-wide table format, e.g. Census data releases ## Minor changes Improvement offline handling sqlite tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0310","dir":"Changelog","previous_headings":"","what":"cansim 0.3.10","title":"cansim 0.3.10","text":"CRAN release: 2021-09-27","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-10","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.10","text":"Better error handling StatCan returns empty tables Add Hierarchy Geography sqlite tables Better fallback warning messages StatCan table categories internally inconsistent Performance improvements","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-039","dir":"Changelog","previous_headings":"","what":"cansim 0.3.9","title":"cansim 0.3.9","text":"CRAN release: 2021-07-29","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-9","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.9","text":"deprecate list_cansim_tables serach_cansim_tables fallback corresponding “_cube” methods Open Data Canada API changed similar functionality available “_cube” methods tie directly StatCan APIS ## Minor changes Fix issues top level duplicate categories Check expired tables list_cansim_sqlite_cached_tables New auto-update feature sqlite tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-038","dir":"Changelog","previous_headings":"","what":"cansim 0.3.8","title":"cansim 0.3.8","text":"CRAN release: 2021-05-27","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-8","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.8","text":"Exclude vignette automatic CRAN checks fix problem CRAN checks failing StatCan servers lead package removed CRAN (checks still active local environment using GitHub action checks) add release date info cube metadata cube list calls add auto-refresh option sqlite tables remove deprecated adjust_cansim_values_by_variable function","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-037","dir":"Changelog","previous_headings":"","what":"cansim 0.3.7","title":"cansim 0.3.7","text":"CRAN release: 2021-05-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-7","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.7","text":"Fix problem UTF-8 encoding solaris move dbplyr dependence Imports Suggests","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-036","dir":"Changelog","previous_headings":"","what":"cansim 0.3.6","title":"cansim 0.3.6","text":"CRAN release: 2021-05-08","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-6","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.6","text":"Fold part normalize_cansim_values default table vector output, particular always add scaled variable column called val_norm imputed Date column covert categories factors default. New get_cansim_sqlite function stores tables SQLite database facilitates access management data.","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-6","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.6","text":"Adapt changes dplyr, tidyr, tibble fix bug properly add hierarchies category names repeated Use system unzip getOption(\"unzip\") set enable unzip files larger 4GB unix-like systems","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-035","dir":"Changelog","previous_headings":"","what":"cansim 0.3.5","title":"cansim 0.3.5","text":"CRAN release: 2020-03-13","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-5","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.5","text":"Exclude vignettes example code compilation may cause CRAN check errors StatCan servers otherwise temporarily unavailable","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-034","dir":"Changelog","previous_headings":"","what":"cansim 0.3.4","title":"cansim 0.3.4","text":"CRAN release: 2020-03-05","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-4","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.4","text":"Expand get_cansim_table_notes() functionality Add functionality access new cube list API","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-033","dir":"Changelog","previous_headings":"","what":"cansim 0.3.3","title":"cansim 0.3.3","text":"CRAN release: 2019-10-15","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.3","text":"Fix time zone problem parsing formatting times StatCan API","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-032","dir":"Changelog","previous_headings":"","what":"cansim 0.3.2","title":"cansim 0.3.2","text":"CRAN release: 2019-08-26","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-2","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.2","text":"Adjust package changes StatCan API different metadata format","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-031","dir":"Changelog","previous_headings":"","what":"cansim 0.3.1","title":"cansim 0.3.1","text":"CRAN release: 2019-08-19","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.1","text":"Fixes issues arising StatCan changing API row limit","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.1","text":"Optimize vector retrieval REF_DATE","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-030","dir":"Changelog","previous_headings":"","what":"cansim 0.3.0","title":"cansim 0.3.0","text":"CRAN release: 2019-07-18","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-0","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.0","text":"Fixes issues arising StatCan changing API Member Names come concatenated Classification Code default, break existing code. Adds option change fields factors Adds option strip Classification Codes fields Exposes timeout limit deal slow connections large tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-023","dir":"Changelog","previous_headings":"","what":"cansim 0.2.3","title":"cansim 0.2.3","text":"CRAN release: 2019-01-07","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-2-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.2.3","text":"robust table download functions Improved documentation","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-022","dir":"Changelog","previous_headings":"","what":"cansim 0.2.2","title":"cansim 0.2.2","text":"CRAN release: 2018-12-18","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-2-2","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.2.2","text":"Initial CRAN release French metadata implemented","code":""}] +[{"path":"https://mountainmath.github.io/cansim/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Jens von Bergmann Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"about","dir":"Articles","previous_headings":"","what":"About","title":"Getting started with the cansim package","text":"cansim package provides R bindings Statistics Canada’s main socioeconomic time series database, previously known (frequently referred package, elsewhere, ) CANSIM. Data can accessed table number, vector table number coordinate. package accepts old new (NDM) CANSIM table catalogue numbers.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"installing-cansim","dir":"Articles","previous_headings":"","what":"Installing cansim","title":"Getting started with the cansim package","text":"cansim package available CRAN can installed directly using default package installation process: Alternatively, latest development version package can downloaded Github using devtools remotes packages.","code":"install.packages(\"cansim\") # install.packages(\"remotes\") remotes::install_github(\"mountainmath/cansim\") library(cansim)"},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"usage","dir":"Articles","previous_headings":"","what":"Usage","title":"Getting started with the cansim package","text":"know data table catalogue number interested , use get_cansim download entire table. default, data tables retrieved package comes original format provided Statistics Canada enriched several added columns transformations. additional Date column added tries intelligently infer Date object REF_DATE column. additional val_norm column added, applies appropriate scaling factor VALUE column. data coded “thousands dollars”, value 2.4 VALUE column converted value 2400 val_norm column. Similarly, percentage 12.2 VALUE column converted value 0.122 val_norm column. Categorical variables converted factors , necessarily, de-duplicated appending name “parent” category parenthesis. ensures column variables unique retain original ordering. Taking look overview data within table common first step. implemented package get_cansim_table_overview(table_number) function. table number unknown, can browse available tables search survey name, keyword title. Individual series Statistics Canada data tables can also accessed using individual numbered vectors. especially useful building reports using specific indicators. convenience, cansim package allows users specify named vectors, label field added returned data frame containing specified name vector. Larger tables, tables update infrequently can cached database form faster access better performance. get_cansim_connection function facilitates , works mostly identitcal get_cansim function, returns database connection local database StatCan Table data. Calling collect_and_normalize, possibly filtering data, adds metadata loads data memory form identical data retrieved get_cansim. information refer Working large tables vignette.","code":"data <- get_cansim(\"14-10-0293\") #> Accessing CANSIM NDM product 14-10-0293 from Statistics Canada #> Parsing data head(data) #> # A tibble: 6 × 24 #> REF_DATE Date GEO DGUID GeoUID Labour force charact…¹ Statistics #> #> 1 2001-03 2001-03-01 Canada 2016A0000… 11124 Population Estimate #> 2 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Estimate #> 3 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 4 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 5 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Estimate #> 6 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Standard … #> # ℹ abbreviated name: ¹​`Labour force characteristics` #> # ℹ 17 more variables: VALUE , val_norm , UOM , UOM_ID , #> # SCALAR_FACTOR , SCALAR_ID , VECTOR , COORDINATE , #> # STATUS , SYMBOL , TERMINATED , DECIMALS , #> # `Hierarchy for GEO` , #> # `Classification Code for Labour force characteristics` , #> # `Hierarchy for Labour force characteristics` , … get_cansim_table_overview(\"14-10-0293\") #> Reading CANSIM NDM product 14-10-0293 information from cache. #> Labour force characteristics by economic region, three-month moving average, unadjusted for seasonality, last 5 months, inactive #> CANSIM Table 14-10-0293 #> Start Reference Period: 2001-03-01, End Reference Period: 2020-12-01, Frequency: Monthly #> #> Column Geography (76) #> Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia, ... #> #> Column Labour force characteristics (10) #> Labour force, Not in labour force, Employment, Unemployment, Full-time employment, Part-time employment, Population, Unemployment rate, Participation rate, Employment rate #> #> Column Statistics (3) #> Estimate, Standard error of estimate, Standard error of year-over-year change search_cansim_cubes(\"housing price indexes\") #> Retrieving cube information from StatCan servers... #> Warning: StatCan returned table titles or dimension names containing non-breaking spaces #> or control characters. These render as an ordinary space or as nothing at all, #> so the names cannot be typed or copy-pasted, the package has replaced them with #> regular spaces. Repaired 120 names, for example \"… end of the fiscal year #> ending closest to December31\". Nothing on your end causes this and #> nothing on your end can fix it, the characters are in the data StatCan #> publishes. This warning will disappear on its own once StatCan stops sending #> them, which is tracked at https://github.com/mountainMath/cansim/issues/169. #> Set options(cansim.suppress_repair_warnings=TRUE) to silence this. #> # A tibble: 2 × 20 #> cansim_table_number cubeTitleEn cubeTitleFr productId cansimId cubeStartDate #> #> 1 18-10-0073 New housing … Indices de… 18100073 327-0005 1981-01-01 #> 2 18-10-0095 New housing … Indices de… 18100095 327-0029 1981-01-01 #> # ℹ 14 more variables: cubeEndDate , releaseTime , archived , #> # subjectCode , surveyCode , frequencyCode , #> # corrections , issueDate , dimensionNameEn , #> # dimensionNameFr , surveyEn , surveyFr , subjectEn , #> # subjectFr get_cansim_vector(c(\"Metro Van Apartment Construction Price Index\"=\"v44176267\", \"Metro Van CPI\"=\"v41692930\"), start_time = \"2015-05-01\", end_time=\"2015-08-01\") |> dplyr::select(Date,GEO,label,VALUE,val_norm) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 5 × 5 #> Date GEO label VALUE val_norm #> #> 1 2015-05-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 2 2015-06-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 3 2015-07-01 Vancouver, British Columbia Metro Van CPI 122. 122. #> 4 2015-08-01 Vancouver, British Columbia Metro Van CPI 123. 123. #> 5 2015-07-01 Vancouver, British Columbia Metro Van Apartment Con… 153 153 data <- get_cansim_connection(\"14-10-0293\") |> collect_and_normalize() #> Reading CANSIM NDM product 14-10-0293 from parquet. head(data) #> # A tibble: 6 × 24 #> REF_DATE Date GEO DGUID GeoUID Labour force charact…¹ Statistics #> #> 1 2001-03 2001-03-01 Canada 2016A0000… 11124 Population Estimate #> 2 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Estimate #> 3 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 4 2001-03 2001-03-01 Canada 2016A0000… 11124 Labour force Standard … #> 5 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Estimate #> 6 2001-03 2001-03-01 Canada 2016A0000… 11124 Employment Standard … #> # ℹ abbreviated name: ¹​`Labour force characteristics` #> # ℹ 17 more variables: VALUE , val_norm , UOM , UOM_ID , #> # SCALAR_FACTOR , SCALAR_ID , VECTOR , COORDINATE , #> # STATUS , SYMBOL , TERMINATED , DECIMALS , #> # `Hierarchy for GEO` , #> # `Classification Code for Labour force characteristics` , #> # `Hierarchy for Labour force characteristics` , …"},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"license","dir":"Articles","previous_headings":"","what":"License","title":"Getting started with the cansim package","text":"code package licensed MIT license. bundled table metadata Sysdata.R, well Statistics Canada data retrieved using package made available Statistics Canada Open Licence Agreement, copy included R folder. Statistics Canada Open Licence Agreement requires :","code":"Subject to this agreement, Statistics Canada grants you a worldwide, royalty-free, non-exclusive licence to: - use, reproduce, publish, freely distribute, or sell the Information; - use, reproduce, publish, freely distribute, or sell Value-added Products; and, - sublicence any or all such rights, under terms consistent with this agreement. In doing any of the above, you shall: - reproduce the Information accurately; - not use the Information in a way that suggests that Statistics Canada endorses you or your use of the Information; - not misrepresent the Information or its source; - use the Information in a manner that does not breach or infringe any applicable laws; - not merge or link the Information with any other databases for the purpose of attempting to identify an individual person, business or organization; and - not present the Information in such a manner that gives the appearance that you may have received, or had access to, information held by Statistics Canada about any identifiable individual person, business or organization."},{"path":"https://mountainmath.github.io/cansim/articles/cansim.html","id":"attribution","dir":"Articles","previous_headings":"","what":"Attribution","title":"Getting started with the cansim package","text":"Subject Statistics Canada Open Licence Agreement, licensed products using Statistics Canada data employ following acknowledgement source:","code":"Acknowledgment of Source (a) You shall include and maintain the following notice on all licensed rights of the Information: - Source: Statistics Canada, name of product, reference date. Reproduced and distributed on an \"as is\" basis with the permission of Statistics Canada. (b) Where any Information is contained within a Value-added Product, you shall include on such Value-added Product the following notice: - Adapted from Statistics Canada, name of product, reference date. This does not constitute an endorsement by Statistics Canada of this product."},{"path":"https://mountainmath.github.io/cansim/articles/listing_cansim_tables.html","id":"listing-and-filtering-tables","dir":"Articles","previous_headings":"","what":"Listing and filtering tables","title":"Listing Statistics Canada data tables","text":"Calling list_cansim_cubes returns data frame useful metadata available tables. 21 fields metadata table including title, English French, keyword sets, notes, table numbers. appropriate table can found subsetting filtering properties want use find appropriate tables. search came two tables. example interested unemployment rate 2015 onward Lower Mainland, Vancouver Island, Okanagan economic regions Labour Force Characteristics table. use tidyr package reshape data long format wider format. can visualize results ggplot2.","code":"library(cansim) names(list_cansim_cubes()) #> Retrieving cube information from StatCan servers... #> Warning: StatCan returned table titles or dimension names containing non-breaking spaces #> or control characters. These render as an ordinary space or as nothing at all, #> so the names cannot be typed or copy-pasted, the package has replaced them with #> regular spaces. Repaired 120 names, for example \"… end of the fiscal year #> ending closest to December31\". Nothing on your end causes this and #> nothing on your end can fix it, the characters are in the data StatCan #> publishes. This warning will disappear on its own once StatCan stops sending #> them, which is tracked at https://github.com/mountainMath/cansim/issues/169. #> Set options(cansim.suppress_repair_warnings=TRUE) to silence this. #> [1] \"cansim_table_number\" \"cubeTitleEn\" \"cubeTitleFr\" #> [4] \"productId\" \"cansimId\" \"cubeStartDate\" #> [7] \"cubeEndDate\" \"releaseTime\" \"archived\" #> [10] \"subjectCode\" \"surveyCode\" \"frequencyCode\" #> [13] \"corrections\" \"issueDate\" \"dimensionNameEn\" #> [16] \"dimensionNameFr\" \"surveyEn\" \"surveyFr\" #> [19] \"subjectEn\" \"subjectFr\" library(dplyr, warn.conflicts = FALSE) list_cansim_cubes() %>% filter(grepl(\"Labour force characteristics\",cubeTitleEn), grepl(\"economic region\",cubeTitleEn)) %>% select(cansim_table_number,cubeTitleEn) #> Retrieving cube information from temporary cache. #> # A tibble: 4 × 2 #> cansim_table_number cubeTitleEn #> #> 1 14-10-0090 Labour force characteristics by province, territory and e… #> 2 14-10-0293 Labour force characteristics by economic region, three-mo… #> 3 14-10-0462 Labour force characteristics by economic region, three-mo… #> 4 14-10-0464 Labour force characteristics by province, territory and e… library(tidyr) selected_table <- \"14-10-0293\" data <-get_cansim(selected_table) %>% filter(grepl(\"Mainland|Vancouver Island|Okanagan\", GEO), Date>=as.Date(\"2015-01-01\"), `Labour force characteristics`==\"Unemployment rate\") %>% select(Date, GEO, Statistics, val_norm) %>% spread(key=\"Statistics\", value=val_norm) #> Accessing CANSIM NDM product 14-10-0293 from Statistics Canada #> Parsing data library(ggplot2) ggplot(data, aes(x=Date, group = GEO,y=Estimate)) + geom_ribbon(aes(ymin=Estimate - `Standard error of estimate`, ymax=Estimate + `Standard error of estimate`, fill=\"\"), alpha=0.8) + geom_line(aes(color=GEO)) + scale_y_continuous(labels=scales::percent) + scale_fill_manual(name = \"\", values=\"grey80\", label=\"Standard error\") + theme_bw() + labs(title = \"Comparison of unemployment rate by economic region\", y = \"Unemployment Rate\", x = \"\", color = \"\", caption=paste0(\"CANSIM \", selected_table))"},{"path":"https://mountainmath.github.io/cansim/articles/partial_table_data_download.html","id":"using-vectors-instead-of-coordinates","dir":"Articles","previous_headings":"","what":"Using vectors instead of coordinates","title":"Partial table data download","text":"can achieved downloading data vectors. need add vector information table template. Vector information available coordinates, also gives effective way filter invalid coordinate combinations template. Vector information available census data tables. gives us data , possibly shorter time series coordinates querying data vector pull data times specific vector available. accessed vector coordinate data differ limited way, values difference NA won’t affect results. completeness plot vector data obtain identical graph.","code":"bp_template_filtered_vecotrs <- bp_template_filtered |> add_cansim_vectors_to_template() bp_data_vector <- bp_template_filtered_vecotrs$VECTOR |> na.omit() |> get_cansim_vector() #> Accessing CANSIM NDM vectors from Statistics Canada bp_data_vector |> mutate(Value=case_when( # count demolitions and deconversions as negative Variables %in% c(\"Number of dwelling-units demolished\",\"Number of dwelling-units lost\") ~ - val_norm, TRUE ~ val_norm )) |> mutate(Name=gsub(\", .+\",\"\",GEO), Year=strftime(Date,\"%Y\")) |> summarize(Value=sum(Value),n=n(),.by=c(Name,Year,`Type of work`)) |> filter(n==12,!is.na(Value)) |> # only show years with complete 12 months of data ggplot(aes(x=Year,y=Value,fill=`Type of work`)) + geom_bar(stat=\"identity\") + facet_wrap(~Name,scales=\"free_y\") + scale_y_continuous(labels=scales::comma) + theme(axis.text.x = element_text(angle=90, hjust=1)) + labs(title=\"Building permits for residential structures in Canadian metro areas\", y=\"Number of dwelling units\", x=NULL, fill=\"Metric\", caption=\"StatCan Table 34-10-0285\")"},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"retrieving-individual-vectors","dir":"Articles","previous_headings":"","what":"Retrieving individual vectors","title":"Retrieving individual Statistics Canada vectors","text":"Many time-series data available Statistics Canada individual vector codes. vector codes follow naming format lower-case “v” identifying numbers. Time-series tables often bundle many series together, resulting large sometimes unwieldy files. Many users Canadian statistical data, often concerned specific time series CPI international arrivals, typically know exact series need. reason, cansim package also provides two functions make easier retrieve individual vectors: get_cansim_vector() get_cansim_vector_for_latest_periods().","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"get_cansim_vector","dir":"Articles","previous_headings":"","what":"get_cansim_vector()","title":"Retrieving individual Statistics Canada vectors","text":"Running search_cansim_cubes(\"consumer price index\") shows 32 tables results. However, tracking Canadian Consumer Price Index (CPI) time, might already know Statistics Canada vector code seasonally-unadjusted -items CPI value: v41690973. retrieve just data series without additional data available related tables, can use get_cansim_vector() function vector code date onwards want get vector results . call get_cansim_vector takes three inputs: string code (codes) vectors, start_time YYYY-MM-DD format, optional value end_time, also YYYY-MM-DD format. default, start_time end_time vectors uses Statistics Canada’s reference periods (“REF_DATE”) selecting date range data retrieved vectors. optional input parameters function. end_time provided, call use current date default series end time. optional parameter use_ref_date set FALSE, vector retrieval instead filter release date vector . Vectors can coerced list object order retrieve multiple series time. example, provincial seasonally-unadjusted CPI values vector codes. vector code British Columbia -items CPI v41692462. code retrieves monthly Canadian BC CPI values period January 2015 December 2017 . Monthly data series always dated first day month.","code":"get_cansim_vector(\"v41690973\",\"2015-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 139 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2015-01-… 2015-01-01 Cana… All-items 124. 124. 2002… 17 #> 2 2015-02-… 2015-02-01 Cana… All-items 125. 125. 2002… 17 #> 3 2015-03-… 2015-03-01 Cana… All-items 126. 126. 2002… 17 #> 4 2015-04-… 2015-04-01 Cana… All-items 126. 126. 2002… 17 #> 5 2015-05-… 2015-05-01 Cana… All-items 127. 127. 2002… 17 #> 6 2015-06-… 2015-06-01 Cana… All-items 127. 127. 2002… 17 #> 7 2015-07-… 2015-07-01 Cana… All-items 127. 127. 2002… 17 #> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 #> # ℹ 129 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS vectors <- c(\"v41690973\",\"v41692462\") get_cansim_vector(vectors, \"2017-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 230 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2017-01-… 2017-01-01 Cana… All-items 130. 130. 2002… 17 #> 2 2017-02-… 2017-02-01 Cana… All-items 130. 130. 2002… 17 #> 3 2017-03-… 2017-03-01 Cana… All-items 130. 130. 2002… 17 #> 4 2017-04-… 2017-04-01 Cana… All-items 130. 130. 2002… 17 #> 5 2017-05-… 2017-05-01 Cana… All-items 130. 130. 2002… 17 #> 6 2017-06-… 2017-06-01 Cana… All-items 130. 130. 2002… 17 #> 7 2017-07-… 2017-07-01 Cana… All-items 130. 130. 2002… 17 #> 8 2017-08-… 2017-08-01 Cana… All-items 130. 130. 2002… 17 #> 9 2017-09-… 2017-09-01 Cana… All-items 131. 131. 2002… 17 #> 10 2017-10-… 2017-10-01 Cana… All-items 131. 131. 2002… 17 #> # ℹ 220 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS "},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"get_cansim_vectors_for_latest_periods","dir":"Articles","previous_headings":"","what":"get_cansim_vectors_for_latest_periods()","title":"Retrieving individual Statistics Canada vectors","text":"vectors extend backwards significant number periods may interest. get_cansim_vectors_for_lates_periods() wrapper around get_cansim_vectors takes periods input instead arguments start_time end_time, provides data selected vector(s) last n periods data available, irrespective dates.","code":"get_cansim_vector_for_latest_periods(\"v41690973\", periods = 60) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 60 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2021-08-… 2021-08-01 Cana… All-items 143. 143. 2002… 17 #> 2 2021-09-… 2021-09-01 Cana… All-items 143. 143. 2002… 17 #> 3 2021-10-… 2021-10-01 Cana… All-items 144. 144. 2002… 17 #> 4 2021-11-… 2021-11-01 Cana… All-items 144. 144. 2002… 17 #> 5 2021-12-… 2021-12-01 Cana… All-items 144 144 2002… 17 #> 6 2022-01-… 2022-01-01 Cana… All-items 145. 145. 2002… 17 #> 7 2022-02-… 2022-02-01 Cana… All-items 147. 147. 2002… 17 #> 8 2022-03-… 2022-03-01 Cana… All-items 149. 149. 2002… 17 #> 9 2022-04-… 2022-04-01 Cana… All-items 150. 150. 2002… 17 #> 10 2022-05-… 2022-05-01 Cana… All-items 152. 152. 2002… 17 #> # ℹ 50 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS "},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"naming-vector-series","dir":"Articles","previous_headings":"","what":"Naming vector series","title":"Retrieving individual Statistics Canada vectors","text":"examples, used v41690973 Canada v41692462 BC. can hard remember can get annoying work . vector retrieval functions cansim package allow named vector extraction. works providing user-determined string directly get_* call. may useful working table code vector codes information name become easy lose track .","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"normalizing-data","dir":"Articles","previous_headings":"","what":"Normalizing data","title":"Retrieving individual Statistics Canada vectors","text":"Data retrieved vectors also gains additional val_norm column normalized values.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/retrieving_cansim_vectors.html","id":"putting-it-all-together","dir":"Articles","previous_headings":"","what":"Putting it all together","title":"Retrieving individual Statistics Canada vectors","text":"quick example uses list two named vectors starting date input value, converts values (“normalizes”) fly, prepares simple ggplot2 graphic. access metadata vectors can use get_cansim_vector_info call","code":"vectors <- c(\"Canadian CPI\"=\"v41690973\", \"BC CPI\"=\"v41692462\") data <- get_cansim_vector(vectors, \"2010-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada library(ggplot2) ggplot(data,aes(x=Date,y=val_norm,color=label)) + geom_line() + labs(title=\"Consumer Price Index, January 2010 to September 2018\", subtitle = \"Seasonally-unadjusted, all-items (2002 = 100)\", caption=paste0(\"CANSIM vectors \",paste0(vectors,collapse = \", \")),x=\"\",y=\"\",color=\"\") get_cansim_vector_info(vectors) #> # A tibble: 2 × 10 #> DECIMALS VECTOR table COORDINATE title_en title_fr UOM frequencyCode #> #> 1 1 v41690973 18-10-0004 2.2 Canada;… Canada;… 17 6 #> 2 1 v41692462 18-10-0004 26.2 British… Colombi… 17 6 #> # ℹ 2 more variables: SCALAR_ID , title "},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"retrieving-metadata","dir":"Articles","previous_headings":"","what":"Retrieving metadata","title":"Working with Statistics Canada data table object hierarchies","text":"get_cansim_table_overview function displays overview table information. table yet downloaded cached first download table . Let’s take look ’s table interested .","code":"library(cansim) # select a table number table_id = \"36-10-0402\" # get table overview get_cansim_table_overview(table_id) #> Gross domestic product (GDP) at basic prices, by industry, provinces and territories, inactive #> CANSIM Table 36-10-0402 #> Start Reference Period: 1997-01-01, End Reference Period: 2024-01-01, Frequency: 12 #> #> Column Geography (13) #> Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia, ... #> #> Column Prices (3) #> Current dollars, Chained (2017) dollars, Contributions to percent change #> #> Column North American Industry Classification System (NAICS) (337) #> All industries, Goods-producing industries, Service-producing industries, Industrial production, Non-durable manufacturing industries, Durable manufacturing industries, Information and communication technology sector, Information and communication technology, manufacturing, Information and communication technology, services, Energy sector, ..."},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"accessing-table-data","dir":"Articles","previous_headings":"","what":"Accessing table data","title":"Working with Statistics Canada data table object hierarchies","text":"see data set come three different measures 307 different NAICS values. Let’s load data focus just “Chained (2017) dollars”.","code":"library(dplyr, warn.conflicts = FALSE) data <- get_cansim(table_id) #> Reading CANSIM NDM product 36-10-0402 from cache. selected_value = data$Prices[grepl(\"Chained\",data$Prices)] %>% unique() data <- data %>% filter(Prices == selected_value)"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"taking-advantage-of-metadata","dir":"Articles","previous_headings":"","what":"Taking advantage of metadata","title":"Working with Statistics Canada data table object hierarchies","text":"table includes different levels NAICS categories one dimension. makes working data level rather cumbersome often interested specific sub-categories. internal hierarchy can help . Let’s first get overview data. can also use easily compute shares instead totals. can extract hierarchy using built-convenience function categories_for_level takes cansim-package retrieved data table object metadata input requires field extract categories well level indicating target depth level hierarchy wish extract.","code":"# Extract top-level hierarchy to calculate total top_level <- categories_for_level(data, \"North American Industry Classification System (NAICS)\",0) # Extract total using hierarchy and calculate share by NAICS. # This could also be done using grouping functions from dplyr, # but we wanted to demonstrate how to use specific hierarchy levels. total_data <- data %>% filter(`North American Industry Classification System (NAICS)` %in% top_level) %>% rename(Total = val_norm) %>% select(Date, GEO, Total) # Merge total back in and calculate share for every NAICS code data <- data %>% left_join(total_data,by = c(\"Date\", \"GEO\")) %>% mutate(Share = val_norm/Total)"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_hierarchies.html","id":"hierarchies-in-more-detail","dir":"Articles","previous_headings":"","what":"Hierarchies in more detail","title":"Working with Statistics Canada data table object hierarchies","text":"hundreds NAICS codes many make sense time. can use categories_for_level reduce NAICS codes just first sub-level represents industry groups. can call subset cut_data. (Note NAICS data also includes composite groups industries, something like level 0.5 hierarchy, prefixed “T” want remove well.) still 22 level 1 categories, many sensibly visualize time. can use dplyr functions identify top categories group rest can plot easier understand. data prepared, last step putting together visualization using ggplot2. can see adjustments required. Let’s closer look “Real estate rental leasing” “Construction” categories. turn categories_for_level function make grabbing sub-categories easier process. observe resulting chart largest contributors GDP sector British Columbia Owner-occupied dwellings (imputed rent) Lessors Real estate (rent), followed Residential building construction.","code":"cut_data <- data %>% filter( !grepl(\"T\\\\d+\",`Classification Code for North American Industry Classification System (NAICS)`), `North American Industry Classification System (NAICS)` %in% categories_for_level(.,\"North American Industry Classification System (NAICS)\",1)) # How many are NAICS categories left? n <- length(cut_data$`North American Industry Classification System (NAICS)` %>% unique) # Specify which regions and period we want to look at regions = \"British Columbia\" period = \"2019-07-01\" # Select the top-8 categories for our reference region and period top_categories <- cut_data %>% filter(GEO %in% regions, Date == period) %>% top_n(8,Share) %>% pull(\"North American Industry Classification System (NAICS)\") # Group remaining categories together and prepare data for plot plot_data <- cut_data %>% mutate(NAICS = ifelse(`North American Industry Classification System (NAICS)` %in% top_categories,`North American Industry Classification System (NAICS)`,\"Rest\")) %>% select(Date, GEO, NAICS, VALUE, Share) %>% group_by(Date, GEO, NAICS) %>% summarise(VALUE = sum(VALUE, na.rm = TRUE), Share = sum(Share, na.rm = TRUE), .groups = \"drop\") library(ggplot2) ggplot(plot_data %>% filter(GEO %in% regions), aes(x = Date, y = Share, fill = NAICS)) + geom_area(position=\"stack\") + scale_y_continuous(labels = scales::percent) + theme_bw() + theme(legend.position = \"bottom\",legend.direction =\"vertical\") + guides(fill=guide_legend(ncol = 3)) + labs(title=\"Gross domestic product (GDP) at basic prices\", subtitle=selected_value, x=\"\", fill = \"\", caption=paste0(\"CANSIM \", table_id)) real_construction <- c(\"Construction [23]\",\"Real estate and rental and leasing [53]\") # Get the NAICS hierarchy codes just for these categories rrl_hierarchy <- data %>% filter(`North American Industry Classification System (NAICS)` %in% real_construction) %>% pull(\"Hierarchy for North American Industry Classification System (NAICS)\") %>% unique # Filter out all sub-categories for Real Estate. # The paste with | trick ensures that we grepl for all matches. rrl_data <- data %>% filter(grepl(paste(rrl_hierarchy,collapse=\"|\"),`Hierarchy for North American Industry Classification System (NAICS)`)) # Ensure we only retain the NAICS leaves and none of the aggregate subcategories rrl_data <- rrl_data %>% filter( `North American Industry Classification System (NAICS)` %in% categories_for_level(.,\"North American Industry Classification System (NAICS)\")) %>% rename(NAICS=`North American Industry Classification System (NAICS)`) # Plot with labels from our original selections ggplot(rrl_data %>% filter(GEO %in% regions), aes(x = Date, y = Share, fill = NAICS)) + geom_area(position = \"stack\") + scale_y_continuous(labels = scales::percent) + theme_bw() + theme(legend.position = \"bottom\",legend.direction =\"vertical\") + guides(fill=guide_legend(ncol=1)) + labs(title=\"Gross domestic product (GDP) at basic prices\", subtitle=paste0(regions,\", \", selected_value), x=\"\", caption=paste0(\"CANSIM \", table_id))"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"working-with-cached-tables","dir":"Articles","previous_headings":"","what":"Working with cached tables","title":"Working with large tables","text":"data cached function download data first convert specified format. package designed differences database formats mostly abstracted away. make good use data look metadata inspect member columns variables available. gives us understanding available variables. purpose vignette interested breakdown sales units Vehicle type Canada overall. data stored raw form database, processing done augmented GeoUID. parquet feather sqlite get_cansim_table_overview(\"20-10-0001\") #> Reading CANSIM NDM product 20-10-0001 information cache. #> New motor vehicle sales, inactive #> CANSIM Table 20-10-0001 #> Start Reference Period: 1946-01-01, End Reference Period: 2024-12-01, Frequency: Monthly #> #> Column Geography (11) #> Newfoundland Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, British Columbia Territories, ... #> #> Column Vehicle type (3) #> Passenger cars, Trucks, Total, new motor vehicles #> #> Column Origin manufacture (5) #> North America, Total, overseas, Japan, countries, Total, country manufacture #> #> Column Sales (2) #> Units, Dollars #> #> Column Seasonal adjustment (2) #> Unadjusted, Seasonally adjusted","code":"connection.parquet <- get_cansim_connection(\"20-10-0001\") # format='parquet' is the default #> Reading CANSIM NDM product 20-10-0001 from parquet. glimpse(connection.parquet) #> FileSystemDataset with 1 Parquet file #> 163,410 rows x 19 columns #> $ REF_DATE \"1965-06\", \"1965-06\", \"1965-06\", \"1965-06\", \"… #> $ GEO \"Quebec\", \"Quebec\", \"Quebec\", \"Quebec\", \"Onta… #> $ DGUID \"2016A000224\", \"2016A000224\", \"2016A000224\", … #> $ `Vehicle type` \"Trucks\", \"Trucks\", \"Trucks\", \"Trucks\", \"Pass… #> $ `Origin of manufacture` \"North America\", \"North America\", \"Total, ove… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Un… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ UOM_ID \"300\", \"81\", \"300\", \"81\", \"300\", \"81\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"thousands\", \"… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", … #> $ VECTOR \"v42170117\", \"v42170118\", \"v42170119\", \"v4217… #> $ COORDINATE \"6.3.2.1.1\", \"6.3.2.2.1\", \"6.3.3.1.1\", \"6.3.3… #> $ VALUE 2314, 10590, 32, 84, 27810, 92118, 2944, 6173… #> $ STATUS NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ TERMINATED NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", … #> $ GeoUID \"24\", \"24\", \"24\", \"24\", \"35\", \"35\", \"35\", \"35… #> Call `print()` for full schema details connection.feather <- get_cansim_connection(\"20-10-0001\", format='feather') #> Reading CANSIM NDM product 20-10-0001 from feather. glimpse(connection.feather) #> FileSystemDataset with 1 Feather file #> 163,410 rows x 19 columns #> $ REF_DATE \"1970-02\", \"1970-02\", \"1970-02\", \"1970-02\", \"… #> $ GEO \"New Brunswick\", \"New Brunswick\", \"New Brunsw… #> $ DGUID \"2016A000213\", \"2016A000213\", \"2016A000213\", … #> $ `Vehicle type` \"Total, new motor vehicles\", \"Total, new moto… #> $ `Origin of manufacture` \"Total, country of manufacture\", \"Total, coun… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Un… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Dollars\", \"Unit… #> $ UOM_ID \"300\", \"81\", \"300\", \"81\", \"300\", \"81\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"thousands\", \"… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", \"3\", \"0\", … #> $ VECTOR \"v42170069\", \"v42170071\", \"v42170078\", \"v4217… #> $ COORDINATE \"5.1.1.1.1\", \"5.1.1.2.1\", \"5.2.1.1.1\", \"5.2.1… #> $ VALUE 1254, 4609, NA, NA, 736, 2691, 231, 557, NA, … #> $ STATUS NA, NA, \"x\", \"x\", NA, NA, NA, NA, \"x\", \"x\", \"… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ TERMINATED NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", … #> $ GeoUID \"13\", \"13\", \"13\", \"13\", \"13\", \"13\", \"13\", \"13… #> Call `print()` for full schema details connection.sqlite <- get_cansim_connection(\"20-10-0001\", format='sqlite') #> Reading CANSIM NDM product 20-10-0001 from sqlite. glimpse(connection.sqlite) #> Rows: ?? #> Columns: 19 #> $ REF_DATE \"1946-01\", \"1946-01\", \"1946-01\", \"1946-01\", \"1… #> $ GEO \"Canada\", \"Canada\", \"Canada\", \"Canada\", \"Canad… #> $ GeoUID \"11124\", \"11124\", \"11124\", \"11124\", \"11124\", \"… #> $ DGUID \"2016A000011124\", \"2016A000011124\", \"2016A0000… #> $ `Vehicle type` \"Total, new motor vehicles\", \"Total, new motor… #> $ `Origin of manufacture` \"Total, country of manufacture\", \"Total, count… #> $ Sales \"Units\", \"Dollars\", \"Units\", \"Units\", \"Dollars… #> $ `Seasonal adjustment` \"Unadjusted\", \"Unadjusted\", \"Unadjusted\", \"Sea… #> $ UOM \"Units\", \"Dollars\", \"Units\", \"Units\", \"Dollars… #> $ UOM_ID \"300\", \"81\", \"300\", \"300\", \"81\", \"300\", \"300\",… #> $ SCALAR_FACTOR \"units\", \"thousands\", \"units\", \"units\", \"thous… #> $ SCALAR_ID \"0\", \"3\", \"0\", \"0\", \"3\", \"0\", \"0\", \"3\", \"0\", \"… #> $ VECTOR \"v42169911\", \"v42169913\", \"v42169920\", \"v42169… #> $ COORDINATE \"1.1.1.1.1\", \"1.1.1.2.1\", \"1.2.1.1.1\", \"1.2.1.… #> $ VALUE 2756, 4507, 1102, 1468, 1604, 1654, 2037, 2903… #> $ STATUS NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ SYMBOL NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ TERMINATED NA, NA, NA, \"t\", NA, NA, \"t\", NA, NA, NA, NA, … #> $ DECIMALS \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"0\", \"…"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"filtering-and-loading-into-memory","dir":"Articles","previous_headings":"","what":"Filtering and loading into memory","title":"Working with large tables","text":"order work data need load memory, done calling collect() connection object. want make use additional metadata processing cansim package usually main operations done connection filtering (renaming de-selecting columns needed enriching metadata) can utilize custom collect_and_normalize function time normalize data appear way used get_cansim function. add category hierarchy metadata normalized value column. case sqlite connections might want pass disconnect = TRUE argument collect_and_normalize function close connection normalizing data, manually later time via disconnect_cansim_connection(connection). required parquet feather connections. collect_and_normalize() interface designed used way across database formats. comparison also add “traditional” get_cansim() approach reads entire table memory normalizes data. parquet feather sqlite traditional","code":"data.parquet <- connection.parquet %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.parquet %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1965-07 1965-07-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1965-07 1965-07-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1965-08 1965-08-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1965-08 1965-08-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1965-09 1965-09-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1965-09 1965-09-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.feather <- connection.feather %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.feather %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1970-03 1970-03-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1970-03 1970-03-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1970-04 1970-04-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1970-04 1970-04-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1970-05 1970-05-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1970-05 1970-05-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.sqlite <- connection.sqlite %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) %>% collect_and_normalize() data.sqlite %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1946-01 1946-01-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1946-01 1946-01-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1946-02 1946-02-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1946-02 1946-02-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1946-03 1946-03-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1946-03 1946-03-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , … data.memory <- get_cansim(\"20-10-0001\") %>% filter(GEO==\"Canada\", `Seasonal adjustment`==\"Unadjusted\", Sales==\"Units\", `Origin of manufacture`==\"Total, country of manufacture\", `Vehicle type` %in% c(\"Passenger cars\",\"Trucks\")) #> Accessing CANSIM NDM product 20-10-0001 from Statistics Canada #> Parsing data data.memory %>% head() #> # A tibble: 6 × 30 #> REF_DATE Date GEO DGUID GeoUID `Vehicle type` Origin of manufactur…¹ #> #> 1 1946-01 1946-01-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 2 1946-01 1946-01-01 Canada 2016A… 11124 Trucks Total, country of man… #> 3 1946-02 1946-02-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 4 1946-02 1946-02-01 Canada 2016A… 11124 Trucks Total, country of man… #> 5 1946-03 1946-03-01 Canada 2016A… 11124 Passenger cars Total, country of man… #> 6 1946-03 1946-03-01 Canada 2016A… 11124 Trucks Total, country of man… #> # ℹ abbreviated name: ¹​`Origin of manufacture` #> # ℹ 23 more variables: Sales , `Seasonal adjustment` , VALUE , #> # val_norm , UOM , UOM_ID , SCALAR_FACTOR , #> # SCALAR_ID , VECTOR , COORDINATE , STATUS , #> # SYMBOL , TERMINATED , DECIMALS , `Hierarchy for GEO` , #> # `Classification Code for Vehicle type` , #> # `Hierarchy for Vehicle type` , …"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"section","dir":"Articles","previous_headings":"","what":"Working with large tables","title":"Working with large tables","text":"note syntax, resulting data frames, identical.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"working-with-the-data","dir":"Articles","previous_headings":"","what":"Working with the data","title":"Working with large tables","text":"three data formats producing output can now work data fetched subsequently filtered via get_cansim. Given data can filter date range plot .","code":"data.parquet %>% filter(Date>=as.Date(\"1990-01-01\")) %>% ggplot(aes(x=Date,y=val_norm,color=`Vehicle type`)) + geom_smooth(span=0.2,method = 'loess', formula = y ~ x) + theme(legend.position=\"bottom\") + scale_y_continuous(labels = function(d)scales::comma(d,scale=10^-3,suffix=\"k\")) + labs(title=\"Canada new motor vehicle sales\",caption=\"StatCan Table 20-10-0001\", x=NULL,y=\"Number of units\")"},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"partitioning","dir":"Articles","previous_headings":"","what":"Partitioning","title":"Working with large tables","text":"improve read performance parquet feather data one can specify partioning argument calling get_cansim_connection. partition data specified columns. can useful filtering columns read relevant partitions greatly increase read performance sight cost size disk. example dataset mostly accessed filtering geographic regions, might useful partition GeoUID, GEO column querying data name. one partitioning column can specified, helpful large datasets high number dimensions. parquet dataset partitioned subsequent queries mind often faster data retrieval index SQLite database. arrow package guidance partitioning tradeoffs.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"repartitioning","dir":"Articles","previous_headings":"Partitioning Working with cached tables","what":"Repartitioning","title":"Working with large tables","text":"Partitioning happens initial data import changing partitioning parameter subsequent calls get_cansim_connection() won’t effect, although warning get issued specified partitioning empty differs initial partitioning. cases, example lots data queries dataset, might make sense occasionally change partitioning data order optimize read performance. can done cansim_repartition_cached_table() takes new_partitioning argument. Repartitioning happens fairly fast, taking several seconds fairly large tables original CSV several gigabytes size.","code":""},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"keeping-track-of-cached-data","dir":"Articles","previous_headings":"","what":"Keeping track of cached data","title":"Working with large tables","text":"Since now option permanent cache take care manage space properly. list_cansim_sqlite_cached_tables function gives us overview cached data .","code":"list_cansim_cached_tables() #> # A tibble: 51 × 11 #> cansimTableNumber language dataFormat timeCached cansimVersion #> #> 1 11-10-0004 eng parquet 2025-07-18 22:22:12 NA #> 2 11-10-0008 eng parquet 2025-07-18 23:12:15 NA #> 3 11-10-0047 eng parquet 2025-07-15 14:44:05 NA #> 4 11-10-0223 eng parquet 2025-05-21 13:12:41 NA #> 5 11-10-0239 eng parquet 2026-04-29 07:34:19 NA #> 6 13-10-0920 eng parquet 2026-08-17 07:36:26 0.4.5 #> 7 13-10-0920 eng sqlite 2026-08-17 07:36:24 0.4.5 #> 8 14-10-0293 eng parquet 2025-08-16 14:16:06 NA #> 9 14-10-0473 eng parquet 2025-02-24 09:45:30 NA #> 10 17-10-0004 eng parquet 2025-03-31 10:36:38 NA #> # ℹ 41 more rows #> # ℹ 6 more variables: niceSize , rawSize , title , path , #> # timeReleased , upToDate "},{"path":"https://mountainmath.github.io/cansim/articles/working_with_large_tables.html","id":"removing-cached-data","dir":"Articles","previous_headings":"","what":"Removing cached data","title":"Working with large tables","text":"want free disk space can remove cached table several tables. following call remove cached “20-10-0001” tables formats languages. disconnect connection sqlite database.","code":"disconnect_cansim_connection(connection.sqlite) remove_cansim_cached_tables(\"20-10-0001\") #> Removing feather cached data for 20-10-0001 (eng) #> Removing parquet cached data for 20-10-0001 (eng) #> Removing sqlite cached data for 20-10-0001 (eng)"},{"path":"https://mountainmath.github.io/cansim/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jens von Bergmann. Author, maintainer. Dmitry Shkolnik. Author.","code":""},{"path":"https://mountainmath.github.io/cansim/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"von Bergmann Shkolnik (2021). cansim: Accessing Statistics Canada Data Table Vectors. https://CRAN.R-project.org/package=cansim","code":"@Manual{, year = {2021}, author = {Jens {von Bergmann} and Dmitry Shkolnik}, title = {cansim: Accessing Statistics Canada Data Table and Vectors}, url = {https://CRAN.R-project.org/package=cansim}, }"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"cansim","dir":"","previous_headings":"","what":"Retrieve and work with public Statistics Canada data tables in R","title":"Retrieve and work with public Statistics Canada data tables in R","text":"R package retrieve work public Statistics Canada data tables. package: Searches retrieves data tables series Statistics Canada’s socioeconomic data repository (previously known CANSIM) Prepares retrieved data tables analysis-ready tidy data frames Accepts legacy CANSIM table catalogue numbers Allows bilingual data retrieval Offers caching downloaded data faster loading less waiting Includes convenience functions relabelling rescaling well tools working data hierarchies downloaded table objects","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"documentation","dir":"","previous_headings":"","what":"Documentation","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Cansim R package home page reference guide","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Retrieve and work with public Statistics Canada data tables in R","text":"cansim package available CRAN can installed directly. Alternatively, latest development version can downloaded Github using either remotes devtools packages.","code":"install.packages(\"cansim\") # install.packages(\"remotes\") remotes::install_github(\"mountainmath/cansim\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"basic-usage","dir":"","previous_headings":"","what":"Basic Usage","title":"Retrieve and work with public Statistics Canada data tables in R","text":"package accepts use old-format (“051-0013”) new-format (“17-10-0016-01”) table catalogue numbers download entire data tables tidy data frames. Calling either legacy CANSIM table number new NDM number load data. Since transition new data repository, existing tables retained old-format numbers, newly created tables new-format names. See example usage workflow Getting started cansim package vignette.","code":"# Retrieve data for births table: 17-10-0016-01 (formerly: CANSIM 051-0013) births <- get_cansim(\"051-0013\") births <- get_cansim(\"17-10-0016\") # Retrieve data for balance of payment table 36-10-0042-01 (formerly CANSIM 376-8105) bop <- get_cansim(\"3768105\") bop <- get_cansim(\"36-10-0042\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"caching","dir":"","previous_headings":"","what":"Caching","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Many data tables available Statistics Canada’s data repository quite large size. downloading tables, cansim package cache data temporary directory duration current R session. reduces unnecessary waiting recompiling code. force refresh data, pass refresh=TRUE option function call. cache data sessions get_cansim_connection() function retrieves caches data local database returns database connection. allows database level filtering, data manipulation, summarizing calling collect_and_normalize() retrieve data data frame. Data retrieved way identical data retrieved via get_cansim(), possibly row order. call give identical output get_cansim(\"17-10-0016\"), commonly filter otherwise manipulate data calling collect_and_normalize() load data memory. example, filter data include births Canada overall irrespective gender use following code: One difference just calling get_cansim() data cached sessions ‘CANSIM_CACHE_PATH’ environment variable set. Typically set .Renviron file home directory share cache sessions projects. set_cansim_cache_path() function can used set cache path environment variable optionally install permanently .Renviron file. function emit warning package query cached newer version available StatCan. Setting refresh = \"auto\" argument automatically refresh data newer version available, setting refresh = TRUE forces refresh irrespective cached data date . approach especially useful working large tables, see example usage workflow Working large tables vignette.","code":"births <- get_cansim_connection(\"17-10-0016\") |> collect_and_normalize() births <- get_cansim_connection(\"17-10-0016\") |> dplyr::filter(GEO == \"Canada\", Gender == \"Total - gender\") |> collect_and_normalize()"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"bilingual","dir":"","previous_headings":"","what":"Bilingual","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Statistics Canada data tables provided either English French formats, including labels formats. cansim package allows download tables either English French. optional language argument retrieve tables French: Le paquet cansim fonctionne en anglais ou en français. Il existe un argument de langue optionnel pour récupérer les tables en français:","code":"naissances <- get_cansim(\"051-0013\",language=\"fr\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"normalizing-values","dir":"","previous_headings":"","what":"Normalizing values","title":"Retrieve and work with public Statistics Canada data tables in R","text":"package also scales variables reported thousands millions. Statistics Canada data table values may scaled powers 10. example, values VALUE field may reported “millions”, VALUE 10 means 10,000,000. default cansim package adds val_norm column scaled values, get value val_norm VALUE column converted 10 10,000,000 example given. Similarly, percentages converted rates, instead 0-100 normalized 0-1 val_norm column.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"vectors","dir":"","previous_headings":"","what":"Vectors","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Many time-series data available Statistics Canada individual vector codes users Canadian statistical data, often concerned specific time series CPI international arrivals, typically know exact series need. , example, tracking Canadian Consumer Price Index (CPI) time, might already know Statistics Canada vector code seasonally-unadjusted -items CPI value: v41690973. retrieve just data series without additional data available related tables, can use get_cansim_vector() function vector code date onward want get vector results . access metadata vectors, use detailed usage examples available Retrieving individual Statistics Canada vectors vignette.","code":"get_cansim_vector(\"v41690973\",\"2015-01-01\") get_cansim_vector_info(\"v41690973\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"table-overview-metadata","dir":"","previous_headings":"","what":"Table overview metadata","title":"Retrieve and work with public Statistics Canada data tables in R","text":"get_cansim_table_overview function displays overview table information. table yet downloaded cached first download table . Let’s take look ’s table interested .","code":"get_cansim_table_overview(\"36-10-040\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"listing-available-tables","dir":"","previous_headings":"","what":"Listing available tables","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Calling list_cansim_cubes returns data frame useful metadata available tables. 21 fields metadata table including title, English French, keyword sets, notes, table numbers. appropriate table can found subsetting filtering properties want use find appropriate tables. work well standard dplyr verbs. Retrieving table list takes little bit time, results cached duration session. sessions span several days refresh=TRUE argument can passed regenerate list capture newly published tables. Listing Statistics Canada data tables vignette additional detail examples.","code":"list_cansim_cubes() list_cansim_cubes() %>% filter(grepl(\"Labour force characteristics\",cubeTitleEn), grepl(\"economic region\",cubeTitleEn)) %>% select(\"cansim_table_number\",\"cubeTitleEn\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Retrieve and work with public Statistics Canada data tables in R","text":"code package licensed MIT license. Statistics Canada data retrieved using package made available Statistics Canada Open Licence Agreement, copy included inst folder. Statistics Canada Open Licence Agreement requires :","code":"Subject to this agreement, Statistics Canada grants you a worldwide, royalty-free, non-exclusive licence to: - use, reproduce, publish, freely distribute, or sell the Information; - use, reproduce, publish, freely distribute, or sell Value-added Products; and, - sublicence any or all such rights, under terms consistent with this agreement. In doing any of the above, you shall: - reproduce the Information accurately; - not use the Information in a way that suggests that Statistics Canada endorses you or your use of the Information; - not misrepresent the Information or its source; - use the Information in a manner that does not breach or infringe any applicable laws; - not merge or link the Information with any other databases for the purpose of attempting to identify an individual person, business or organization; and - not present the Information in such a manner that gives the appearance that you may have received, or had access to, information held by Statistics Canada about any identifiable individual person, business or organization."},{"path":"https://mountainmath.github.io/cansim/index.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Subject Statistics Canada Open Licence Agreement, licensed products using Statistics Canada data employ following acknowledgement source:","code":"Acknowledgment of Source (a) You shall include and maintain the following notice on all licensed rights of the Information: - Source: Statistics Canada, name of product, reference date. Reproduced and distributed on an \"as is\" basis with the permission of Statistics Canada. (b) Where any Information is contained within a Value-added Product, you shall include on such Value-added Product the following notice: - Adapted from Statistics Canada, name of product, reference date. This does not constitute an endorsement by Statistics Canada of this product."},{"path":"https://mountainmath.github.io/cansim/index.html","id":"why-cansim","dir":"","previous_headings":"","what":"Why cansim?","title":"Retrieve and work with public Statistics Canada data tables in R","text":"CANSIM name Statistics Canada’s legacy socio-economic data repository widely used practitioners, academics, students, many still calling new repository name. Statistics Canada refers current repository simply “Statistics Canada data” “StatCan data”. use CANSIM name package nostalgic reference.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"proxy-issues","dir":"","previous_headings":"","what":"Proxy issues","title":"Retrieve and work with public Statistics Canada data tables in R","text":"users reported issues accessing downloading Statistics Canada tables behind proxy sometimes case office environments. package uses httr2, picks standard proxy environment variables, pointing proxy matter setting making requests. Setting .Renviron file makes configuration stick across sessions.","code":"Sys.setenv(https_proxy=\"http://your_username:your_pass@proxy.example.com:8080\") Sys.setenv(http_proxy=\"http://your_username:your_pass@proxy.example.com:8080\")"},{"path":"https://mountainmath.github.io/cansim/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Retrieve and work with public Statistics Canada data tables in R","text":"Issues pull requests highly appreciated. want get touch, pretty good responding via email via twitter @dshkol @vb_jens.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"related-packages","dir":"","previous_headings":"","what":"Related packages","title":"Retrieve and work with public Statistics Canada data tables in R","text":"statcanR package alternative package providing basic access StatCan NDM tables data discovery. cancensus package designed access, retrieve, work Canadian Census data geography. cansim package designed work conjunction cancensus data can easily joined standard geographic identifiers exposed harmonized packages. cmhc package designed access, retrieve, work CMHC data.","code":""},{"path":"https://mountainmath.github.io/cansim/index.html","id":"cite-cansim","dir":"","previous_headings":"","what":"Cite cansim","title":"Retrieve and work with public Statistics Canada data tables in R","text":"wish cite cansim package work: von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions convenience tools accessing Statistics Canada data tables. v0.4.4. DOI: 10.32614/CRAN.package.cansim BibTeX entry LaTeX users ","code":"@Manual{cansim, author = {Jens {von Bergmann} and Dmitry Shkolnik}, title = {cansim: functions and convenience tools for accessing Statistics Canada data tables}, year = {2025}, doi = {10.32614/CRAN.package.cansim}, note = {R package version 0.4.4}, url = {https://mountainmath.github.io/cansim/} }"},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"Retrieves vector information given table coordinates. can used query data vectors, returns vector information coordinates present data table, gives effective way filter coordinates. Vector information available census data tables.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"","code":"add_cansim_vectors_to_template(template, refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"template (possibly filtered) cansim table template returned `get_cansim_table_template` refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"tibble containing table template added vector information Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_cansim_vectors_to_template.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve series info for given table id and coordinates — add_cansim_vectors_to_template","text":"","code":"if (FALSE) { # \\dontrun{ template <- get_cansim_table_template(\"34-10-0013\") template |> filter(Geography==\"Canada\") |> add_cansim_vectors_to_template() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":null,"dir":"Reference","previous_headings":"","what":"Add provincial abbreviations as factor — add_provincial_abbreviations","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"Add provincial abbreviations factor","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"","code":"add_provincial_abbreviations(data)"},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"data tibble returned get_cansim provincial level data","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"input tibble additional factor GEO.abb contains language-specific provincial abbreviations","code":""},{"path":"https://mountainmath.github.io/cansim/reference/add_provincial_abbreviations.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add provincial abbreviations as factor — add_provincial_abbreviations","text":"","code":"if (FALSE) { # \\dontrun{ df <- get_cansim(\"17-10-0005\") df <- add_provincial_abbreviations(df) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"Returns NDM table catalogue equivalent given standard old-format CANSIM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"","code":"cansim_old_to_new(oldCansimTableNumber)"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"oldCansimTableNumber deprecated style CANSIM table number (e.g. \"427-0001\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"character string new-format NDM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_old_to_new.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate deprecated CANSIM table number into new NDM-format table catalogue number — cansim_old_to_new","text":"","code":"cansim_old_to_new(\"026-0018\") #> [1] \"34-10-0013\""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"Repartitions already downloaded cached parquet feather dataset","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"","code":"cansim_repartition_cached_table( cansimTableNumber, new_partitioning = c(), language = \"english\", format = \"parquet\", cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"cansimTableNumber NDM table number load new_partitioning (Optional) Partition columns use parquet feather formats. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored format (Optional) format data table retrieve. Either \"parquet\", \"feather\", sqlite (default \"parquet\"). cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv(\"CANSIM_CACHE_PATH\")`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/cansim_repartition_cached_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Repartitions a cached cansim table to a new partitioning scheme — cansim_repartition_cached_table","text":"","code":"if (FALSE) { # \\dontrun{ cansim_repartition_cached_table(\"34-10-0013\",new_partitioning=c(\"GeoUID\")) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":null,"dir":"Reference","previous_headings":"","what":"Use metadata to extract categories for column of specific level — categories_for_level","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"tables data hierarchical categories, metadata containing hierarchy level descriptions used extract categories specified level hierarchy .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"","code":"categories_for_level( data, column_name, level = NA, strict = FALSE, remove_duplicates = TRUE )"},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"data data table object returned get_cansim() column_name quoted name column extract categories level hierarchy level depth extract categories, 0 top category strict (default FALSE) TRUE extract specific hierarchy level remove_duplicates (default TRUE) set TRUE higher level grouping categories already captured lower level hierarchy data removed","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"vector categories","code":""},{"path":"https://mountainmath.github.io/cansim/reference/categories_for_level.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use metadata to extract categories for column of specific level — categories_for_level","text":"","code":"if (FALSE) { # \\dontrun{ data <- get_cansim(\"16-10-0117\") categories_for_level(data,\"North American Industry Classification System (NAICS)\",level=2) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":null,"dir":"Reference","previous_headings":"","what":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"Collect data parquet, feather sqlite query normalize cansim table output","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"","code":"collect_and_normalize( connection, replacement_value = \"val_norm\", normalize_percent = TRUE, default_month = \"07\", default_day = \"01\", factors = TRUE, strip_classification_code = FALSE, disconnect = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"connection connection local arrow connection returned get_cansim_connection, possibly filters dplyr verbs applied replacement_value (Optional) name column manipulated value returned . Defaults adding `val_norm` value field. normalize_percent (Optional) true (default) normalizes percentages changing rates default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\") factors (Optional) Logical value indicating dimensions converted factors. (Default set FALSE). strip_classification_code (Optional) Logical value indicating classification code stripped names. (Default set false). disconnect (Optional) used format sqlite. Logical value indicate SQLite database connection disconnected. (Default FALSE)","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"tibble collected normalized data","code":""},{"path":"https://mountainmath.github.io/cansim/reference/collect_and_normalize.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collect data from a parquet, feather or sqlite query and normalize cansim table output — collect_and_normalize","text":"","code":"if (FALSE) { # \\dontrun{ library(dplyr) con <- get_cansim_connection(\"34-10-0013\") data <- con %>% filter(GEO==\"Ontario\") %>% collect_and_normalize() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":null,"dir":"Reference","previous_headings":"","what":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"correspondence file old new StatCan table numbers included package","code":""},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"https://www.statcan.gc.ca/eng/developers-developpeurs/cansim_id-product_id-concordance.csv","code":""},{"path":"https://mountainmath.github.io/cansim/reference/correspondence.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"The correspondence file for old to new StatCan table numbers is included in the package — correspondence","text":"Statistics Canada","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":null,"dir":"Reference","previous_headings":"","what":"create database index — create_index","title":"create database index — create_index","text":"create database index","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create database index — create_index","text":"","code":"create_index(connection, table_name, field)"},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create database index — create_index","text":"connection connection database table_name sql table name field name field index","code":""},{"path":"https://mountainmath.github.io/cansim/reference/create_index.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create database index — create_index","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":null,"dir":"Reference","previous_headings":"","what":"convert csv to arrow — csv2arrow","title":"convert csv to arrow — csv2arrow","text":"convert csv arrow","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert csv to arrow — csv2arrow","text":"","code":"csv2arrow( csv_file, arrow_file, format = \"parquet\", col_names, value_column = \"VALUE\", partitioning = c(), na = c(NA, \"..\", \"\", \"...\", \"F\"), repair_columns = c(), text_encoding = \"UTF-8\", delim = \",\" )"},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert csv to arrow — csv2arrow","text":"csv_file input csv path arrow_file output arrow database path format format arrow file, \"parquet\" \"feather\" (default parquet) col_names column names csv file value_column name value column numeric data partitioning optional partition columns na na character strings repair_columns columns whose values repaired non-breaking spaces control characters writing, usually dimension columns text_encoding encoding csv file (default UTF-8) delim (Optional) csv deliminator, default \",\"","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2arrow.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"convert csv to arrow — csv2arrow","text":"database connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"convert csv sqlite adapted https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"","code":"csv2sqlite( csv_file, sqlite_file, table_name, transform = NULL, chunk_size = 5e+06, append = FALSE, col_types = NULL, na = c(NA, \"..\", \"\", \"...\", \"F\"), text_encoding = \"UTF-8\", delim = \",\", ... )"},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"csv_file input csv path sqlite_file output sql database path table_name sql table name transform optional function transforms chunk chunk_size optional chunk size read/write data, default=1,000,000 append optional parameter, append database overwrite, default=`FALSE` col_types optional parameter csv column types na na character strings text_encoding encoding csv file (default UTF-8) delim (Optional) csv deliminator, default \",\" ... (Optional) additional parameters passed `readr::read_delim_chunked`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/csv2sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"convert csv to sqlite adapted from https://rdrr.io/github/coolbutuseless/csv2sqlite/src/R/csv2sqlite.R — csv2sqlite","text":"database connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html","id":null,"dir":"Reference","previous_headings":"","what":"Disconnect from a cansim connection — disconnect_cansim_connection","title":"Disconnect from a cansim connection — disconnect_cansim_connection","text":"Closes database connection behind table retrieved get_cansim_connection(..., format=\"sqlite\"). Parquet feather connections hold connection close left alone, code know format handed can close either way.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disconnect from a cansim connection — disconnect_cansim_connection","text":"","code":"disconnect_cansim_connection(connection)"},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disconnect from a cansim connection — disconnect_cansim_connection","text":"connection connection cansim table returned get_cansim_connection","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Disconnect from a cansim connection — disconnect_cansim_connection","text":"`NULL`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disconnect from a cansim connection — disconnect_cansim_connection","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") disconnect_cansim_connection(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","title":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","text":"method deprecated removed future version, please use `disconnect_cansim_connection()` instead.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","text":"","code":"disconnect_cansim_sqlite(connection)"},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","text":"connection connection database","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disconnect from a cansim database connection (deprecated) — disconnect_cansim_sqlite","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") disconnect_cansim_connection(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":null,"dir":"Reference","previous_headings":"","what":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"Fold metadata selected columns","code":""},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"","code":"fold_in_metadata_for_columns(data, data_path, column_names)"},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"data tibble StatCan table data e.g. returned get_cansim. data_path base path save parsed metadata column_names names columns","code":""},{"path":"https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fold in metadata and for selected columns — fold_in_metadata_for_columns","text":"tibble including metadata information","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"Retrieves data table using NDM catalogue number tidy data frame. Retrieved table data cached duration current R session default.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"","code":"get_cansim( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\") Set higher values large tables slow network connection. (Default 200).","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"tibble StatCan Table data added Date column inferred date objects added val_norm column normalized value VALUE column. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number — get_cansim","text":"","code":"if (FALSE) { # \\dontrun{ get_cansim(\"34-10-0013\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","title":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","text":"Retrieve data points Statistics Canada changed given coordinates table. Coordinates among ones asked change contribute rows, none changed result empty table rather error. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","text":"","code":"get_cansim_changed_series_data_for_coordinates( cansimTableNumber, coordinates, language = \"english\", timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","text":"cansimTableNumber table number coordinates belong coordinates coordinates retrieve changed data language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","text":"tibble changed data specified coordinates Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for series that changed, by table and coordinate — get_cansim_changed_series_data_for_coordinates","text":"","code":"if (FALSE) { # \\dontrun{ get_cansim_changed_series_data_for_coordinates(\"34-10-0013\",\"1.1\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","title":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","text":"Retrieve data points Statistics Canada changed given vectors. Series among ones asked change contribute rows, none changed result empty table rather error. StatCan API can process 300 vectors time, 300 vectors specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","text":"","code":"get_cansim_changed_series_data_for_vectors( vectors, language = \"english\", timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","text":"vectors list vectors retrieve changed data language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","text":"tibble changed data specified vector(s) Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for series that changed, by vector — get_cansim_changed_series_data_for_vectors","text":"","code":"if (FALSE) { # \\dontrun{ get_cansim_changed_series_data_for_vectors(\"v41690973\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"Retrieve list tables modified updated since specified date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"","code":"get_cansim_changed_tables(start_date, end_date = NULL)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"start_date Starting date YYYY-MM-DD format look changes changed date end_date Optional end date YYYY-MM-DD format look changes changed date, default start date","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"tibble Statistics Canada data table product ids release times Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a list of modified tables since a given date — get_cansim_changed_tables","text":"","code":"# \\donttest{ get_cansim_changed_tables(\"2018-08-01\") #> # A tibble: 8 × 2 #> productId releaseTime #> #> 1 23100251 2018-08-01T08:35 #> 2 33100036 2018-08-01T08:30 #> 3 10100139 2018-08-01T08:30 #> 4 10100125 2018-08-01T08:30 #> 5 10100107 2018-08-01T08:30 #> 6 33100005 2018-08-01T08:30 #> 7 33100033 2018-08-01T08:30 #> 8 33100084 2018-08-01T08:30 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":null,"dir":"Reference","previous_headings":"","what":"Get NDM code sets — get_cansim_code_set","title":"Get NDM code sets — get_cansim_code_set","text":"Useful get list surveys subjects used internally","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get NDM code sets — get_cansim_code_set","text":"","code":"get_cansim_code_set( code_set = c(\"scalar\", \"frequency\", \"symbol\", \"status\", \"uom\", \"survey\", \"subject\", \"wdsResponseStatus\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get NDM code sets — get_cansim_code_set","text":"code_set code set retrieve. refresh Default FALSE, repeated calls session hit cached data. refresh code list running R session set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get NDM code sets — get_cansim_code_set","text":"tibble english french labels given code set Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get NDM code sets — get_cansim_code_set","text":"","code":"# \\donttest{ get_cansim_code_set(\"survey\") #> # A tibble: 900 × 3 #> surveyCode surveyEn surveyFr #> #> 1 1105 Business Register Registr… #> 2 1141 Average Fair Market Value/Purchase Price for New Homes i… Juste v… #> 3 1209 Survey of Environmental Goods and Services Enquête… #> 4 1301 Gross Domestic Product by Industry - National (Monthly) Produit… #> 5 1302 Gross Domestic Product by Industry - Annual Produit… #> 6 1303 Gross Domestic Product by Industry - Provincial and Terr… Produit… #> 7 1401 Supply, Use and Input-Output Tables Tableau… #> 8 1402 Productivity Measures and Related Variables - National a… Mesures… #> 9 1529 Capital Invested Abroad by Canadian Enterprises Capitau… #> 10 1530 Capital Invested in secondary foreign companies by Canad… Capitau… #> # ℹ 890 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"Returns table column details given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"","code":"get_cansim_column_categories( cansimTableNumber, column, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"cansimTableNumber NDM table number load column specified column retrieve category information language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"tibble detailed information StatCan table categories specified field Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table categories for a specific column — get_cansim_column_categories","text":"","code":"# \\donttest{ get_cansim_column_categories(\"34-10-0013\", \"Geography\") #> # A tibble: 50 × 7 #> `Dimension ID` `Dimension name` `Member ID` `Member Name` `Parent Member ID` #> #> 1 1 Geography 1 Canada NA #> 2 1 Geography 2 Newfoundland … 1 #> 3 1 Geography 3 Prince Edward… 1 #> 4 1 Geography 4 Nova Scotia 1 #> 5 1 Geography 5 New Brunswick 1 #> 6 1 Geography 6 Quebec 1 #> 7 1 Geography 7 Ontario 1 #> 8 1 Geography 8 Manitoba 1 #> 9 1 Geography 9 Saskatchewan 1 #> 10 1 Geography 10 Alberta 1 #> # ℹ 40 more rows #> # ℹ 2 more variables: Terminated , Hierarchy # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table column list — get_cansim_column_list","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"Returns table column details given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"","code":"get_cansim_column_list( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"tibble listing column names StatCan table. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_column_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table column list — get_cansim_column_list","text":"","code":"# \\donttest{ get_cansim_column_list(\"34-10-0013\") #> # A tibble: 2 × 2 #> `Dimension ID` `Dimension name` #> #> 1 1 Geography #> 2 2 Type of property # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"Retrieves data table using NDM catalogue number parquet, feather, SQLite database connection. Retrieved table data cached permanently cache path supplied duration current R session. table cached function check newer version available emit warning message cached table date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"","code":"get_cansim_connection( cansimTableNumber, language = \"english\", format = \"parquet\", partitioning = c(), refresh = FALSE, timeout = 1000, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored format (Optional) format data table retrieve. Either \"parquet\", \"feather\", sqlite (default \"parquet\"). partitioning (Optional) Partition columns use parquet feather formats. refresh (Optional) Valid options FALSE (default), TRUE, \"auto\". set TRUE, forces reload data table, set \"auto\" refresh table downloading newest version StatCan table date. set FALSE table date warning emitted alert user data outdated. timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv('CANSIM_CACHE_PATH')`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"database connection local parquet, feather, sqlite database StatCan Table data. data frames calling `collect()` `collect_and_normalize()` identical possibly different row order. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_connection.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number as parquet, feather, or sqlite database connection — get_cansim_connection","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\") # Work with the data connection glimpse(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"Retrieves table metadata given input table number vector table numbers using either new old table number format. Patience suggested Statistics Canada API can slow. `list_cansim_tables()` function can used alternative retrieve (cached) list CANSIM tables (limited) metadata.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"","code":"get_cansim_cube_metadata(cansimTableNumber, type = \"overview\", refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"cansimTableNumber new old CANSIM/NDM table number vector table numbers type type metadata get, options \"overview\", \"members\", \"notes\", \"corrections\". refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"tibble containing table metadata. several table numbers given, metadata tables retrieved single API call results stacked. Types \"overview\" carry table identifier , `cansimTableNumber` column added identify table. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_cube_metadata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve table metadata from Statistics Canada API — get_cansim_cube_metadata","text":"","code":"# \\donttest{ get_cansim_cube_metadata(\"34-10-0013\") #> # A tibble: 1 × 17 #> responseStatusCode productId cansimId cubeTitleEn cubeTitleFr cubeStartDate #> #> 1 0 34-10-0013 026-0018 Residential … Valeurs de… 2005-01-01 #> # ℹ 11 more variables: cubeEndDate , frequencyCode , #> # nbSeriesCube , nbDatapointsCube , releaseTime , #> # archiveStatusCode , archiveStatusEn , archiveStatusFr , #> # subjectCode , surveyCode , issueDate # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"Allows retrieval data Statistics Canada data table specific table coordinates. allows partial targeted download tables can effectively combined get_cansim_table_template function help pinpoint data series interest. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"","code":"get_cansim_data_for_table_coord_periods( tableCoordinates, periods = NULL, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"tableCoordinates Either list vectors coordinates table number, (filtered) data frame returned get_cansim_table_template. periods Optional numeric value number latest periods retrieve data , default NULL case data periods downloaded. Alternatively can specified coordinate tableCoordinates data frame, argument ignored data frame \"periods\" column. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"tibble data matching specified coordinate period input arguments Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_data_for_table_coord_periods.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for specified Statistics Canada data product for last N periods for specific coordinates — get_cansim_data_for_table_coord_periods","text":"","code":"# \\donttest{ get_cansim_data_for_table_coord_periods(list(\"35-10-0003\"=c(\"1.1\",\"1.12\")),periods=3) #> Accessing CANSIM NDM coordinates from Statistics Canada #> # A tibble: 6 × 17 #> REF_DATE Date GEO REF_DATE_2 Custodial and commun…¹ VALUE val_norm #> #> 1 2021-01-01 2021-01-01 Newfou… 2022-01-01 Total actual-in count 2.1 2.1 #> 2 2022-01-01 2022-01-01 Newfou… 2023-01-01 Total actual-in count 1.8 1.8 #> 3 2023-01-01 2023-01-01 Newfou… 2024-01-01 Total actual-in count NA NA #> 4 2021-01-01 2021-01-01 Newfou… 2022-01-01 Probation rate per 10… 29.1 29.1 #> 5 2022-01-01 2022-01-01 Newfou… 2023-01-01 Probation rate per 10… 19.4 19.4 #> 6 2023-01-01 2023-01-01 Newfou… 2024-01-01 Probation rate per 10… 16.7 16.7 #> # ℹ abbreviated name: ¹​`Custodial and community supervision` #> # ℹ 10 more variables: UOM , UOM_ID , SCALAR_ID , VECTOR , #> # cansimTableNumber , COORDINATE , SYMBOL , releaseTime , #> # frequencyCode , DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":null,"dir":"Reference","previous_headings":"","what":"Major economic indicator release schedule — get_cansim_key_release_schedule","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"Returns every release date major economic indicators since March 14, 2012. also includes scheduled future releases.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"","code":"get_cansim_key_release_schedule()"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"tibble data, details major economic indicator release Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_key_release_schedule.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Major economic indicator release schedule — get_cansim_key_release_schedule","text":"","code":"# \\donttest{ get_cansim_key_release_schedule() #> # A tibble: 2,881 × 5 #> date type title description url #> #> 1 2012-03-16 meeting Canada's international transactions in … \"January 2… /dai… #> 2 2012-03-16 meeting Monthly Survey of Manufacturing \"January 2… /dai… #> 3 2012-03-19 meeting Wholesale trade \"January 2… /dai… #> 4 2012-03-20 meeting Travel between Canada and other countri… \"\" /dai… #> 5 2012-03-22 meeting Retail trade \"January 2… /dai… #> 6 2012-03-23 meeting Consumer Price Index \"February … /dai… #> 7 2012-03-29 meeting Industrial product and raw materials pr… \"February … /dai… #> 8 2012-03-29 meeting National tourism indicators \"Fourth qu… /dai… #> 9 2012-03-30 meeting Gross domestic product by industry \"January 2… /dai… #> 10 2012-03-30 meeting Payroll employment, earnings and hours,… \"January 2… /dai… #> # ℹ 2,871 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"Retrieves series information coordinates","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"","code":"get_cansim_series_info_cube_coord( cansimTableNumber, coordinates, timeout = 1000, refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"cansimTableNumber new old CANSIM/NDM table number, coordinates specific single table coordinates vector coordinates timeout (Optional) Number seconds StatCan allowed go without sending data call abandoned. limit long call may take overall, response keeps arriving left alone. refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"tibble containing series information given coordinates Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_series_info_cube_coord.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve series info for given table id and coordinates — get_cansim_series_info_cube_coord","text":"","code":"# \\donttest{ get_cansim_series_info_cube_coord(\"34-10-0013\", c(\"1.1.1.1.1.1\", \"2.1.1.1.1.1\")) #> # A tibble: 0 × 0 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"method deprecated removed future version, please use `get_cansim_connection(..., format=\"sqlite\")` instead. Retrieves data table using NDM catalogue number SQLite table. Retrieved table data cached permanently cache path supplied duration current R session. function check latest release data table emit warning message cached table date.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"","code":"get_cansim_sqlite( cansimTableNumber, language = \"english\", refresh = FALSE, auto_refresh = FALSE, timeout = 1000, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) auto_refresh (Optional) set TRUE, reload data table new version available (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. cache_path (Optional) Path cache table permanently. default, data cached path specified `Sys.getenv('CANSIM_CACHE_PATH')`, set. Otherwise use `tempdir()`.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"database connection local SQLite database StatCan Table data. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_sqlite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table using NDM catalogue number as SQLite database connection (deprecated) — get_cansim_sqlite","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") # Work with the data connection glimpse(con) disconnect_cansim_connection(con) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table information — get_cansim_table_info","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"Returns table information given NDM table catalogue number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"","code":"get_cansim_table_info( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"tibble table overview information Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table information — get_cansim_table_info","text":"","code":"# \\donttest{ get_cansim_table_info(\"34-10-0013\") #> # A tibble: 1 × 7 #> `Cube Title` `Product Id` `CANSIM Id` `Archive Status` Frequency #> #> 1 Residential property valu… 34-10-0013 026-0018 CURRENT - a cub… 12 #> # ℹ 2 more variables: `Start Reference Period` , #> # `End Reference Period` # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"can used check table last updated.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"","code":"get_cansim_table_last_release_date(cansimTableNumber)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"cansimTableNumber NDM table number","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"datetime object release data available, NULL otherwise. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_last_release_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the latest release data for a StatCan table, if available — get_cansim_table_last_release_date","text":"","code":"# \\donttest{ get_cansim_table_last_release_date(\"34-10-0013\") #> [1] \"2018-05-09 12:30:00 UTC\" # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"Returns table notes given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"","code":"get_cansim_table_notes( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"tibble table notes. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_notes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table notes and column categories — get_cansim_table_notes","text":"","code":"# \\donttest{ get_cansim_table_notes(\"34-10-0013\") #> # A tibble: 22 × 4 #> `Note ID` Note `Dimension name` `Member Name` #> #> 1 1 \"The methodology used in the curren… NA NA #> 2 2 \"Changes occurred in census metropo… Geography Québec, Queb… #> 3 2 \"Changes occurred in census metropo… Geography Saguenay, Qu… #> 4 2 \"Changes occurred in census metropo… Geography Sherbrooke, … #> 5 2 \"Changes occurred in census metropo… Geography Trois-Rivièr… #> 6 2 \"Changes occurred in census metropo… Geography Guelph, Onta… #> 7 2 \"Changes occurred in census metropo… Geography Ottawa-Gatin… #> 8 2 \"Changes occurred in census metropo… Geography Gatineau part #> 9 2 \"Changes occurred in census metropo… Geography Kelowna, Bri… #> 10 2 \"Changes occurred in census metropo… Geography Abbotsford-M… #> # ℹ 12 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"Prints table overview information console output. order display table overview information, selected CANSIM table must loaded entirely display overview information. Overview information printed console English French, specified.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"","code":"get_cansim_table_overview( cansimTableNumber, language = \"english\", refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE)","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"none Nothing printed data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_overview.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table overview text — get_cansim_table_overview","text":"","code":"# \\donttest{ get_cansim_table_overview(\"34-10-0013\") #> Residential property values #> CANSIM Table 34-10-0013 #> Start Reference Period: 2005-01-01, End Reference Period: 2015-01-01, Frequency: 12 #> #> Column Geography (50) #> Canada, Newfoundland and Labrador, Prince Edward Island, Nova Scotia, New Brunswick, Quebec, Ontario, Manitoba, Saskatchewan, Alberta, ... #> #> Column Type of property (1) #> Residential # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"Returns table notes given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"","code":"get_cansim_table_short_notes( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"tibble StatCan Notes table Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_short_notes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table short notes — get_cansim_table_short_notes","text":"","code":"# \\donttest{ get_cansim_table_short_notes(\"34-10-0013\") #> # A tibble: 3 × 2 #> `Note ID` Note #> #> 1 1 \"The methodology used in the current release differs from that used… #> 2 2 \"Changes occurred in census metropolitan area geographical boundari… #> 3 3 \"Changes occurred in census metropolitan area geographical boundari… # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"Returns table subject detail given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"","code":"get_cansim_table_subject( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"tibble table subject code name. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_subject.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table subject detail — get_cansim_table_subject","text":"","code":"# \\donttest{ get_cansim_table_subject(\"34-10-0013\") #> # A tibble: 2 × 1 #> `Subject Code` #> #> 1 3406 #> 2 4602 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"Returns table survey detail given NDM table number English French. Retrieved table information data cached duration R session .","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"","code":"get_cansim_table_survey( cansimTableNumber, language = \"english\", refresh = FALSE, timeout = 200 )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"tibble table survey code name Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_survey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve Statistics Canada data table survey detail — get_cansim_table_survey","text":"","code":"# \\donttest{ get_cansim_table_survey(\"34-10-0013\") #> # A tibble: 1 × 1 #> `Survey Code` #> #> 1 5213 # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve table template from Statistics Canada API — get_cansim_table_template","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"table template consists dimensions members coordinates table can used explore filter table data downloading subsets table. add vector Ids (possibly filtered) template `add_cansim_vectors_to_template` function can used.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"","code":"get_cansim_table_template( cansimTableNumber, language = \"english\", refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"cansimTableNumber new old CANSIM/NDM table number vector table numbers language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh Refresh data Statistics Canada API","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"tibble containing table template, `cansimTableNumber` column identifying table. several table numbers given, templates stacked columns dimensions appear tables filled `NA` tables. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_template.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve table template from Statistics Canada API — get_cansim_table_template","text":"","code":"# \\donttest{ get_cansim_table_template(\"34-10-0013\") #> # A tibble: 50 × 4 #> cansimTableNumber COORDINATE Geography `Type of property` #> #> 1 34-10-0013 1.1 Canada Residential #> 2 34-10-0013 2.1 Newfoundland and Labrador Residential #> 3 34-10-0013 3.1 Prince Edward Island Residential #> 4 34-10-0013 4.1 Nova Scotia Residential #> 5 34-10-0013 5.1 New Brunswick Residential #> 6 34-10-0013 6.1 Quebec Residential #> 7 34-10-0013 7.1 Ontario Residential #> 8 34-10-0013 8.1 Manitoba Residential #> 9 34-10-0013 9.1 Saskatchewan Residential #> 10 34-10-0013 10.1 Alberta Residential #> # ℹ 40 more rows # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"Retrieve URL table API given table number. Offers stable approach manually guessing URL table.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"","code":"get_cansim_table_url(cansimTableNumber, language = \"english\")"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"cansimTableNumber NDM table number load language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"String object containing URL specified table number Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_table_url.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve a Statistics Canada data table URL given a table number — get_cansim_table_url","text":"","code":"# \\donttest{ get_cansim_table_url(\"34-10-0013\") #> [1] \"https://www150.statcan.gc.ca/n1/tbl/csv/34100013-eng.zip\" get_cansim_table_url(\"34-10-0013\", language = \"fr\") #> [1] \"https://www150.statcan.gc.ca/n1/tbl/csv/34100013-fra.zip\" # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"Allows retrieval data specified vector series given time window. Accessing data vector allows targeted extraction time series. Discovering vectors interest can achieved using StatCan table web interface using get_cansim_table_template function help pinpoint data series interest, chaining add_cansim_vectors_to_template function add cansim vector information template data. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"","code":"get_cansim_vector( vectors, start_time = as.Date(\"1800-01-01\"), end_time = Sys.time(), use_ref_date = TRUE, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"vectors list vectors retrieve start_time Starting date YYYY-MM-DD format, applies REF_DATE releaseTime, depending use_ref_date parameter end_time Set optional end time filter YYYY-MM-DD format (defaults current system time) use_ref_date Optional, TRUE default. set TRUE, uses REF_DATE vector data filter, otherwise uses StatisticsCanada's releaseDate value filtering specified vectors. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"tibble data vectors released start end time Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for a Statistics Canada data vector released within a given time frame — get_cansim_vector","text":"","code":"# \\donttest{ get_cansim_vector(\"v41690973\",\"2015-01-01\") #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 139 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2015-01-… 2015-01-01 Cana… All-items 124. 124. 2002… 17 #> 2 2015-02-… 2015-02-01 Cana… All-items 125. 125. 2002… 17 #> 3 2015-03-… 2015-03-01 Cana… All-items 126. 126. 2002… 17 #> 4 2015-04-… 2015-04-01 Cana… All-items 126. 126. 2002… 17 #> 5 2015-05-… 2015-05-01 Cana… All-items 127. 127. 2002… 17 #> 6 2015-06-… 2015-06-01 Cana… All-items 127. 127. 2002… 17 #> 7 2015-07-… 2015-07-01 Cana… All-items 127. 127. 2002… 17 #> 8 2015-08-… 2015-08-01 Cana… All-items 127. 127. 2002… 17 #> 9 2015-09-… 2015-09-01 Cana… All-items 127. 127. 2002… 17 #> 10 2015-10-… 2015-10-01 Cana… All-items 127. 127. 2002… 17 #> # ℹ 129 more rows #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"Allows retrieval data specified vector series N -recently released periods. Accessing data vector allows targeted extraction time series. Discovering vectors interest can achieved using StatCan table web interface using get_cansim_table_template function help pinpoint data series interest, chaining add_cansim_vectors_to_template function add cansim vector information template data. StatCan API can process 300 coordinates time, 300 coordinates specified function batch requests API.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"","code":"get_cansim_vector_for_latest_periods( vectors, periods = NULL, language = \"english\", refresh = FALSE, timeout = 200, factors = TRUE, default_month = \"07\", default_day = \"01\" )"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"vectors list vectors retrieve periods Numeric value number latest periods retrieve data , default data retrieved. language \"english\" (default) \"french\". Short forms \"en\", \"eng\", \"fr\" \"fra\" accepted, French names \"anglais\" \"francais\"; case accents ignored refresh (Optional) set TRUE, forces reload data table (default FALSE) timeout (Optional) Number seconds StatCan allowed go without sending data download abandoned, work around scenarios StatCan servers drop network connection. limit long download may take overall, transfer keeps delivering data left alone. StatCan prepares whole response sending , large requests can take better part minute, values much default 200 risk cutting legitimate requests. factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). default_month default month used creating Date objects annual data (default set \"07\") default_day default day month used creating Date objects monthly data (default set \"01\")","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"tibble data specified vector(s) last N periods Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_for_latest_periods.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve data for specified Statistics Canada data vector(s) for last N periods — get_cansim_vector_for_latest_periods","text":"","code":"# \\donttest{ get_cansim_vector_for_latest_periods(\"v41690973\",10) #> Accessing CANSIM NDM vectors from Statistics Canada #> # A tibble: 10 × 16 #> REF_DATE Date GEO Products and product…¹ VALUE val_norm UOM UOM_ID #> #> 1 2025-10-… 2025-10-01 Cana… All-items 165. 165. 2002… 17 #> 2 2025-11-… 2025-11-01 Cana… All-items 165. 165. 2002… 17 #> 3 2025-12-… 2025-12-01 Cana… All-items 165 165 2002… 17 #> 4 2026-01-… 2026-01-01 Cana… All-items 165 165 2002… 17 #> 5 2026-02-… 2026-02-01 Cana… All-items 166. 166. 2002… 17 #> 6 2026-03-… 2026-03-01 Cana… All-items 167. 167. 2002… 17 #> 7 2026-04-… 2026-04-01 Cana… All-items 168 168 2002… 17 #> 8 2026-05-… 2026-05-01 Cana… All-items 170. 170. 2002… 17 #> 9 2026-06-… 2026-06-01 Cana… All-items 169 169 2002… 17 #> 10 2026-07-… 2026-07-01 Cana… All-items 170. 170. 2002… 17 #> # ℹ abbreviated name: ¹​`Products and product groups` #> # ℹ 8 more variables: SCALAR_ID , VECTOR , cansimTableNumber , #> # COORDINATE , SYMBOL , releaseTime , frequencyCode , #> # DECIMALS # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"Allows retrieval metadata Statistics Canada data vectors","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"","code":"get_cansim_vector_info(vectors)"},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"vectors vector cansim vectors","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"tibble metadata selected vectors Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_cansim_vector_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve metadata for specified Statistics Canada data vectors — get_cansim_vector_info","text":"","code":"# \\donttest{ get_cansim_vector_info(\"v41690973\") #> # A tibble: 1 × 10 #> DECIMALS VECTOR table COORDINATE title_en title_fr UOM frequencyCode #> #> 1 1 v41690973 18-10-0004 2.2 Canada;… Canada;… 17 6 #> # ℹ 2 more variables: SCALAR_ID , title # }"},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"Get column names de-duplicated correct order","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"","code":"get_deduped_column_level_data(cansimTableNumber, language, column)"},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"cansimTableNumber table number language language column names column column name","code":""},{"path":"https://mountainmath.github.io/cansim/reference/get_deduped_column_level_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get column names de-duplicated and in the correct order — get_deduped_column_level_data","text":"tibble column names","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"List cached cansim arrow SQlite databases","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"","code":"list_cansim_cached_tables( cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`. refresh Optional, refresh last updated date cached cansim tables","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"tibble list tables currently cached given cache path.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List cached cansim arrow and SQlite databases — list_cansim_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cached_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":null,"dir":"Reference","previous_headings":"","what":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"Generates overview table containing metadata available Statistics Canada data cubes.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"","code":"list_cansim_cubes(lite = FALSE, refresh = FALSE, quiet = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"lite Get version without cube dimensions comments faster retrieval, default FALSE. refresh Default FALSE, repeated calls session hit cached data. quiet Optional, suppress messages refresh code list running R session set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"tibble available Statistics Canada data cubes, including NDM table number, cube title, start end dates, achieve status, subject survey codes, frequency codes list cube dimensions. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_cubes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get overview list for all Statistics Canada data cubes — list_cansim_cubes","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cubes() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"method deprecated removed future version, please use `list_cansim_cached_tables()` instead.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"","code":"list_cansim_sqlite_cached_tables( cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\"), refresh = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`. refresh Optional, refresh last updated date cached cansim tables","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"tibble list tables currently cached given cache path.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_sqlite_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List cached cansim SQLite database (deprecated) — list_cansim_sqlite_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_cached_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"method deprecated, please use `list_cansim_cubes` instead. Generates overview table containing metadata available Statistics Canada data tables. new updated table generated table already exist cached form force refresh option selected (set FALSE default). can take time process involves scraping hundreds Statistics Canada web pages gather required metadata. option cansim.cache_path set look store overview table directory.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"","code":"list_cansim_tables(refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"refresh Default FALSE, regenerate table set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"tibble available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description, geography Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/list_cansim_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get overview list for all Statistics Canada data tables (deprecated) — list_cansim_tables","text":"","code":"if (FALSE) { # \\dontrun{ list_cansim_tables() } # }"},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":null,"dir":"Reference","previous_headings":"","what":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"Facilitates working Statistics Canada data table values retrieved using package setting units counts/dollars instead millions, etc. \"replacement_value\" set, replace VALUE field normalized values drop scale column. Otherwise keep scale columns create new column named replacement_value normalized value. attempt parse REF_DATE field create R date variable. currently experimental.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"","code":"normalize_cansim_values( data, replacement_value = \"val_norm\", normalize_percent = TRUE, default_month = \"01\", default_day = \"01\", factors = TRUE, strip_classification_code = FALSE, cansimTableNumber = NULL, internal = FALSE )"},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"data retrieved data table returned get_cansim() get_cansim_ndm() replacement_value (Optional) name column manipulated value returned . Defaults \"val_norm\" normalize_percent (Optional) TRUE (default) normalizes percentages changing rates default_month default month used creating Date objects annual data (default set \"01\") default_day default day month used creating Date objects monthly data (default set \"01\") factors (Optional) Logical value indicating dimensions converted factors. (Default set TRUE). strip_classification_code Logical value indicating classification code stripped names. (Default set FALSE, factors=TRUE overridden set TRUE). cansimTableNumber (Optional) needed operating results SQLite connections. internal (Optional) Flag indicate function called internally.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"Returns tibble adjusted values.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/normalize_cansim_values.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Normalize retrieved data table values to appropriate scales — normalize_cansim_values","text":"","code":"if (FALSE) { # \\dontrun{ cansim_table <- get_cansim(\"34-10-0013\") normalize_cansim_values(cansim_table) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse metadata — parse_metadata","title":"Parse metadata — parse_metadata","text":"Parse metadata","code":""},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse metadata — parse_metadata","text":"","code":"parse_metadata(meta, data_path)"},{"path":"https://mountainmath.github.io/cansim/reference/parse_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse metadata — parse_metadata","text":"meta raw metadata table data_path base path save parsed metadata","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"Remove cached cansim SQLite parquet database","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"","code":"remove_cansim_cached_tables( cansimTableNumber, format = c(\"parquet\", \"feather\", \"sqlite\"), language = NULL, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"cansimTableNumber Vector table(s) removed, (filtered) table returned `list_cansim_cached_tables` list tables removed. format Format cache remove, possible values `\"parquet\"`, `\"feather\"` `\"sqlite\"` subset (default ) language Language remove cached data, named get_cansim(). unspecified (`NULL`) tables languages removed. cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_cached_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove cached cansim SQLite and parquet database — remove_cansim_cached_tables","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"parquet\") remove_cansim_cached_tables(\"34-10-0013\", format=\"parquet\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"method deprecated removed future version, please use `remove_cansim_cached_tables(..., format=\"sqlite\")` instead.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"","code":"remove_cansim_sqlite_cached_table( cansimTableNumber, language = NULL, cache_path = Sys.getenv(\"CANSIM_CACHE_PATH\") )"},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"cansimTableNumber Number table removed language Language remove cached data, named get_cansim(). unspecified (`NULL`) tables languages removed cache_path Optional, default value `Sys.getenv('CANSIM_CACHE_PATH')`","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"`NULL“","code":""},{"path":"https://mountainmath.github.io/cansim/reference/remove_cansim_sqlite_cached_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove cached cansim SQLite database (deprecated) — remove_cansim_sqlite_cached_table","text":"","code":"if (FALSE) { # \\dontrun{ con <- get_cansim_connection(\"34-10-0013\", format=\"sqlite\") disconnect_cansim_connection(con) remove_cansim_cached_tables(\"34-10-0013\", format=\"sqlite\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":null,"dir":"Reference","previous_headings":"","what":"Search through Statistics Canada data cubes — search_cansim_cubes","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"Searches Statistics Canada data cubes using search term.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"","code":"search_cansim_cubes(search_term, refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"search_term User-supplied search term used find Statistics Canada data cubes matching titles, table numbers, subject survey codes. refresh Default FALSE. underlying cube list cached duration R sessions regenerate cube list set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"tibble available Statistics Canada data cubes, listing title, Statistics Canada data cube catalogue number, deprecated CANSIM table number, survey subject. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_cubes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Search through Statistics Canada data cubes — search_cansim_cubes","text":"","code":"if (FALSE) { # \\dontrun{ search_cansim_cubes(\"Labour force\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"method deprecated, please use `search_cansim_cubes` instead. Searches Statistics Canada data tables using search term. new table generated already exist refresh option set TRUE. Search-terms case insensitive, accept regular expressions advanced searching. search function can search either table titles table descriptions, depending whether search_description set TRUE . refresh = TRUE, table updated regenerated using Statistics Canada's latest data. can take time since process involves scraping several hundred web pages gather required metadata. option cache_path set look store overview table directory.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"","code":"search_cansim_tables(search_term, search_fields = \"both\", refresh = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"search_term User-supplied search term used find Statistics Canada data tables matching titles search_fields default, function search table titles keywords. Setting parameter \"title\" search title, setting \"keyword\" search keywords refresh Default FALSE, regenerate table set TRUE","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"tibble available Statistics Canada data tables, listing title, Statistics Canada data table catalogue number, deprecated CANSIM table number, description geography match search term. Returns NULL data retrieved StatCan unavailable.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/search_cansim_tables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Search through Statistics Canada data tables (deprecated) — search_cansim_tables","text":"","code":"if (FALSE) { # \\dontrun{ search_cansim_tables(\"Labour force\") } # }"},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Set persistent cansim cache location — set_cansim_cache_path","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"Cansim provides session caching retrieved data. function create persistent cache across sessions data accessed via `get_cansim_connection` caches data database across sessions..","code":""},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"","code":"set_cansim_cache_path(cache_path, overwrite = FALSE, install = FALSE)"},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"cache_path local directory use saving cached data overwrite Option overwrite existing cache path already stored locally. install Option install permanently use across sessions.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/set_cansim_cache_path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set persistent cansim cache location — set_cansim_cache_path","text":"","code":"if (FALSE) { # \\dontrun{ set_cansim_cache_path(\"~/cansim_cache\") # This will set the cache path permanently until overwritten again set_cansim_cache_path(\"~/cancensus_cache\", install = TRUE) } # }"},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":null,"dir":"Reference","previous_headings":"","what":"View saved cache directory path — show_cansim_cache_path","title":"View saved cache directory path — show_cansim_cache_path","text":"View saved cache path'","code":""},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"View saved cache directory path — show_cansim_cache_path","text":"","code":"show_cansim_cache_path()"},{"path":"https://mountainmath.github.io/cansim/reference/show_cansim_cache_path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"View saved cache directory path — show_cansim_cache_path","text":"","code":"show_cansim_cache_path() #> [1] \"/Users/jens/data/cansim.data\""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":null,"dir":"Reference","previous_headings":"","what":"View CANSIM table or vector information in browser — view_cansim_webpage","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"Opens CANSIM table vector Statistics Canada's website using default browser. may useful getting info CANSIM table survey methods.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"","code":"view_cansim_webpage(cansimTableNumber = NULL)"},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"cansimTableNumber CANSIM NDM table number cansim vectors \"v\" prefix. number provided, vector search page Statistic Canada website opened.","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"none","code":""},{"path":"https://mountainmath.github.io/cansim/reference/view_cansim_webpage.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"View CANSIM table or vector information in browser — view_cansim_webpage","text":"","code":"if (FALSE) { # \\dontrun{ view_cansim_webpage(\"34-10-0013\") } # }"},{"path":[]},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-4-5","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.4.5","text":"StatCan unavailable longer aborts error. Timeouts, connection failures error responses now reported loud warning function returns NULL, script document can decide servers . applies every function talks StatCan, also covers two calls previously bypassed retry helper, get_cansim_table_last_release_date() get_cansim_series_info_cube_coord(). Set options(cansim.error_on_unavailable=TRUE) get previous behaviour raising error examples make single lightweight API call now \\donttest{} rather \\dontrun{}, checked rather merely displayed. Examples download full table cube list stay \\dontrun{} run time, cansim_old_to_new() needs network example now always runs data retrieved vector table/coordinate now carries UOM UOM_ID columns, taken cube metadata. StatCan flags single dimension cube carrying unit measure unit varies member dimension, unit resolved per coordinate. Tables unit measure, example census tables, get unit columns, matching full table download (#170). unit known, percentage values retrieved vector coordinate now normalized way full table downloads: val_norm carries value divided 100 unit measure relabelled Rate (Taux French). Previously series normalized differently depending whether retrieved full table vector, scripts fetch percentage vectors see val_norm change factor 100 non-breaking spaces control characters names returned StatCan now replaced regular spaces. characters render ordinary space nothing , column whose name contained one reached typing copy-pasting console displayed. repair covers table downloads, vector coordinate calls, cube metadata, table templates cube list, emits warning shows offending characters code point, example Performance strategy, together count many names repaired. Set options(cansim.suppress_repair_warnings=TRUE) silence warning. warning also says characters data StatCan publishes rather anything user , disappear StatCan stops sending , pointing issue tracked. Column names tables cached release keep original characters table downloaded , get_cansim_connection() warns finds cache (#169) repair now also covers member labels data , just names columns holding . characters turn common member labels dimension names, 53 500 sampled tables carry least one. Repairing metadata side left labels data unable match factor levels, every row carrying affected label become NA. Labels now also identical whichever way data retrieved, table can joined template, vector coordinate data dimension columns (#169) internal scan_statcan_character_problems() reads cube metadata straight API, without repair applied, reports every title, dimension name member name StatCan publishes non-breaking space control character , table, level language. summarize_statcan_character_problems() aggregates survey. Neither exported, exist track whether upstream problem shrinking, go away along repair (#169) cached tables now record package version parsed alongside download timestamp, single .Rda_info file replaces .Rda_time file timestamp used . timestamp says whether StatCan newer data, version says whether release still reads files way. list_cansim_cached_tables() reports new cansimVersion column, empty anything cached release. old timestamp file still read, existing caches keep download date, replaced table refreshed. get_cansim_connection() uses version check whether cache predates repair non-breaking spaces control characters, reads metadata cached alongside table see whether dimension names member labels actually carry . warn, naming offending label pointing refresh=TRUE (#169) every call sends StatCan list vectors, coordinates tables now split batches 300 items. StatCan refuses longer list outright HTTP 416, gone unnoticed calls already batched. get_cansim_vector_info() cube metadata download , asking either 300 items time failed rather returning data vector coordinate StatCan answer longer passed data. StatCan signals bad item two different ways depending method, either marking record FAILED answering SUCCESS putting reason responseStatusCode, package checked first. let invalid vector get_cansim_vector_info() row NAs indistinguishable real metadata. now checked everywhere, items carry data dropped reported reason, naming vectors coordinates concerned vector calls come back nothing now warn return empty table. Previously empty answer travelled metadata join surfaced Column 'cansimTableNumber' exist, said nothing happened. warning names three things produce : vectors exist, vectors data requested time frame, daily window midnight 8:30am Eastern StatCan serve vector data StatCan refuses request explains response body, explanation now shown alongside status code instead discarded. HTTP 409 says whether product simply released yet, HTTP 416 names limit request went past. two status codes also got plain-language translation codes already . HTTP 504 message now says StatCan builds whole response sending , way past gateway timeout ask less rather retry request two new functions expose StatCan’s changed series data methods, report changed finer grain get_cansim_changed_tables() . get_cansim_changed_series_data_for_vectors() get_cansim_changed_series_data_for_coordinates() retrieve data points StatCan changed, shape metadata corresponding get_cansim_vector() coordinate calls. Series change simply contribute rows, none ones asked changed answer empty table rather error. Like vector methods batch requests 300 items. StatCan’s third changed series method, one listing every series changed today, implemented exported. regularly fails answer : StatCan works whole response sending , changed series numbering hundreds thousands request outlives StatCan’s gateway comes back HTTP 504 nine minutes silence. Exporting wait clear whether fault simply method behaves package now talks StatCan httr2 rather httr. Requests fail status StatCan recovers within seconds, HTTP 429, 500, 502 504, now retried exponential backoff jitter honour Retry-header, previous retries went back back stood good chance arriving server still busy. Requests also throttled 25 per second StatCan documents per-IP limit, script asking many tables vectors longer risks turned away asking quickly, now identify cansim/ user agent. Statuses improve retry deliberately retried: HTTP 416 carries items StatCan accepts however often sent, HTTP 409 nightly update window, HTTP 503 StatCan maintenance outage, lasts far longer retry budget worth spending. 503 case says , says try later, rather appearing hang retries run . Users behind proxy note httr2 reads standard http_proxy https_proxy environment variables instead taking httr::set_config() call timeout argument now bounds long StatCan may go without sending anything, rather long whole transfer may take. cap total tell connection StatCan stopped answering large table simply taking , cut alike, slow download fail two hundred seconds data already hand. transfer keeps delivering now left alone however long runs, one goes quiet timeout seconds dropped, distinction argument always described making. Note StatCan works whole response sending , taking roughly tenth second per vector, request full batch 300 silent something like thirty five seconds first byte arrives; default two hundred seconds leaves ample room , much smaller value passed hand cut large requests. Establishing connection bounded separately briefly, unreachable host now fails ten seconds instead waiting full timeout get_cansim() get_cansim_connection() now ask StatCan table lives instead assembling download address table number. address package built guess layout StatCan free change, extra call replaces small next table download precedes","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"deprecations-0-4-5","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"cansim 0.4.5","text":"get_cansim_sqlite(), list_cansim_sqlite_cached_tables() remove_cansim_sqlite_cached_table() now also documented deprecated, matching deprecation warnings already emit. Use get_cansim_connection(..., format=\"sqlite\"), list_cansim_cached_tables() remove_cansim_cached_tables(..., format=\"sqlite\") instead disconnect_cansim_sqlite() deprecated favour new disconnect_cansim_connection(), thing name claim format. closes sqlite connection leaves parquet feather connections alone, connection can closed without knowing format came . last function still named sqlite deprecated, example demonstrated deprecated get_cansim_sqlite() deprecated get_cansim_sqlite(), list_cansim_sqlite_cached_tables(), remove_cansim_sqlite_cached_table(), disconnect_cansim_sqlite(), list_cansim_tables() search_cansim_tables() scheduled removal future release","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"performance-0-4-5","dir":"Changelog","previous_headings":"","what":"Performance","title":"cansim 0.4.5","text":"vector queries now collect 300-vector API batches list combine , instead repeatedly copying previously collected rows every new batch. offline warm-cache benchmark, combining 100 batches 150,000 rows improved 0.424s 0.227s hierarchy building metadata parsing longer re-parses growing hierarchy paths, hierarchies built one ancestor level time across members coordinates split character matrix folding metadata converting factors factor conversion dimensions duplicate member names splits unique coordinates instead every row, table repeats coordinate per reference period. 36-10-0580 6,882 unique coordinates 996,978 rows, cutting cached read 4.5s 4.0s table templates built single cartesian product instead joining one dimension time metadata data retrieved vector table/coordinate now resolved coordinates . member table dimension used rebuilt every single coordinate, made step grow linearly 24ms per coordinate. Resolving 200 coordinates 36-10-0580 went 5.0s 0.02s, 10,164 coordinates table now take 0.03s. Warnings members missing cube metadata reported per member rather per coordinate uses ","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-5","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.5","text":"unrecognized language argument now error naming passed, instead NA travelled cache directory name tail StatCan URL surfaced later download failure missing column. Either language can named either language, \"english\", \"en\", \"eng\" \"anglais\" select English \"french\", \"fr\", \"fra\" \"français\" select French, along longer shorter forms; case, surrounding whitespace accents ignored. get_cansim_table_url() get_cansim_table_notes() now default \"english\" like every function takes language, selects language previous \"en\" default (#152) drop unreachable (TRUE) ... else ... metadata parsing. else branch held readr::read_delim() implementation utils::read.delim() replaced February 2025 since fallen behind live branch, longer working fallback (#151) fix case_when() deprecation warning emitted dplyr 1.2.0 every table read fix get_cansim_changed_tables() passing “days” difftime() time zone instead unit get_cansim_changed_tables() now takes current date cutoff day’s changes available Eastern time. used compare 9am, half hour StatCan actually closes nightly update window, take “today” local clock, machine set west Eastern ask StatCan day started yet get_cansim_connection() longer fails release date table determined, staleness check skipped message instead unit measure columns French language tables now ordered value columns, already English language tables better connection error handling fix get_cansim_cube_metadata() get_cansim_table_template() vectors table numbers, metadata tables still retrieved single API call cached per table get_cansim_cube_metadata() adds cansimTableNumber column “members”, “notes” “corrections” types functions operate single table now fail informative message given several table numbers normalizing percentages now relabels unit measure Rate, Taux French tables, documentation always described; comparison relabelling never match , unit columns used keep original Percent... labels values divided 100 add_cansim_vectors_to_template() now finds vectors coordinates whose member ids end zero, trimming trailing .0 positions used eat member ids like 10 affected rows came back NA vector French connections longer emit spurious “Unknown table type” warning collect_and_normalize(), internal language comparison never matched French setting refreshing cached table fails StatCan unavailable, get_cansim_connection() now falls back previously cached version warning instead returning NULL. Refreshing cube metadata degrades way, notes, column, overview template functions keep working previously seen metadata servers duplicated-column error caching table now actually names offending columns longer blames SQLite parquet feather connections","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-044","dir":"Changelog","previous_headings":"","what":"cansim 0.4.4","title":"cansim 0.4.4","text":"CRAN release: 2025-08-19","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-4","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.4","text":"fix problem metadata parsing work properly table names make documentations consistent wrt default langauge names add convenience functions setting cache paths data accessed via get_cansim_connection","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-043","dir":"Changelog","previous_headings":"","what":"cansim 0.4.3","title":"cansim 0.4.3","text":"CRAN release: 2025-05-30","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.3","text":"better handling duplicated levels metadata, ignore duplication geography names census tables emit warning fix issue accessing tables without footnotes","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-042","dir":"Changelog","previous_headings":"","what":"cansim 0.4.2","title":"cansim 0.4.2","text":"CRAN release: 2025-05-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-2","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.2","text":"ensure proper ordering levels even StatCan metadata ordered better error messages information disable peer checking StatCan SSL certificates problems automatically batch vector coordinate data retrieval case users request 300 series time ## Major changes enable series information table coordinate generate table template facilitate adding vector info aid pinpointed data download enable downloading data vector multiple coordinates get_cansim_data_for_table_coord_periods (breaking changes change parameter)","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-041","dir":"Changelog","previous_headings":"","what":"cansim 0.4.1","title":"cansim 0.4.1","text":"CRAN release: 2025-03-15","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-4-1","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.4.1","text":"fix problem parsing census data tables fix problem converting factors classification codes attached.","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-04","dir":"Changelog","previous_headings":"","what":"cansim 0.4","title":"cansim 0.4","text":"CRAN release: 2025-02-24","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-4","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.4","text":"add support local caching parquet feather formats uniform interface sqlite, parquet, feather caching principled approach column order ## Minor changes fix problem inconsistent type parsing notes better support french language accessing data vector coordinate tests","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0317","dir":"Changelog","previous_headings":"","what":"cansim 0.3.17","title":"cansim 0.3.17","text":"CRAN release: 2024-11-06","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-17","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.17","text":"fix problem reading French tables released census division restore original column order converting factors convert geography column factor available fix problem add_provincial_abbreviations lead mislabelling provinces cases improve handling metadata, enable downloading metadata instead via full table download fold metadata data accessing via vector coordinates allow cansim vectors view_cansim_webpage view vector information statcan browser","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0316","dir":"Changelog","previous_headings":"","what":"cansim 0.3.16","title":"cansim 0.3.16","text":"CRAN release: 2024-03-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-16","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.16","text":"improve offline handling StatCan servers improve metadata handling Member ID order mixed metadata fix problem refreshing data get_cansim_vectors","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0315","dir":"Changelog","previous_headings":"","what":"cansim 0.3.15","title":"cansim 0.3.15","text":"CRAN release: 2023-10-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-15","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.15","text":"accommodate quirks table 98-10-0017","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0314","dir":"Changelog","previous_headings":"","what":"cansim 0.3.14","title":"cansim 0.3.14","text":"CRAN release: 2023-01-20","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-14","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.14","text":"Better header parsing avoid warning messages Fix problem semi-wide tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0313","dir":"Changelog","previous_headings":"","what":"cansim 0.3.13","title":"cansim 0.3.13","text":"CRAN release: 2022-11-07","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-13","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.13","text":"Speed access cached sqlite tables Fix problem get_cansim_vector_info()","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0312","dir":"Changelog","previous_headings":"","what":"cansim 0.3.12","title":"cansim 0.3.12","text":"CRAN release: 2022-07-12","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-12","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.12","text":"Fix bug causes collect_and_normalize function operating systems","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0311","dir":"Changelog","previous_headings":"","what":"cansim 0.3.11","title":"cansim 0.3.11","text":"CRAN release: 2022-05-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-11","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.11","text":"Support new semi-wide table format, e.g. Census data releases ## Minor changes Improvement offline handling sqlite tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-0310","dir":"Changelog","previous_headings":"","what":"cansim 0.3.10","title":"cansim 0.3.10","text":"CRAN release: 2021-09-27","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-10","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.10","text":"Better error handling StatCan returns empty tables Add Hierarchy Geography sqlite tables Better fallback warning messages StatCan table categories internally inconsistent Performance improvements","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-039","dir":"Changelog","previous_headings":"","what":"cansim 0.3.9","title":"cansim 0.3.9","text":"CRAN release: 2021-07-29","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-9","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.9","text":"deprecate list_cansim_tables serach_cansim_tables fallback corresponding “_cube” methods Open Data Canada API changed similar functionality available “_cube” methods tie directly StatCan APIS ## Minor changes Fix issues top level duplicate categories Check expired tables list_cansim_sqlite_cached_tables New auto-update feature sqlite tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-038","dir":"Changelog","previous_headings":"","what":"cansim 0.3.8","title":"cansim 0.3.8","text":"CRAN release: 2021-05-27","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-8","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.8","text":"Exclude vignette automatic CRAN checks fix problem CRAN checks failing StatCan servers lead package removed CRAN (checks still active local environment using GitHub action checks) add release date info cube metadata cube list calls add auto-refresh option sqlite tables remove deprecated adjust_cansim_values_by_variable function","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-037","dir":"Changelog","previous_headings":"","what":"cansim 0.3.7","title":"cansim 0.3.7","text":"CRAN release: 2021-05-10","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-7","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.7","text":"Fix problem UTF-8 encoding solaris move dbplyr dependence Imports Suggests","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-036","dir":"Changelog","previous_headings":"","what":"cansim 0.3.6","title":"cansim 0.3.6","text":"CRAN release: 2021-05-08","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-6","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.6","text":"Fold part normalize_cansim_values default table vector output, particular always add scaled variable column called val_norm imputed Date column covert categories factors default. New get_cansim_sqlite function stores tables SQLite database facilitates access management data.","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-6","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.6","text":"Adapt changes dplyr, tidyr, tibble fix bug properly add hierarchies category names repeated Use system unzip getOption(\"unzip\") set enable unzip files larger 4GB unix-like systems","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-035","dir":"Changelog","previous_headings":"","what":"cansim 0.3.5","title":"cansim 0.3.5","text":"CRAN release: 2020-03-13","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-5","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.5","text":"Exclude vignettes example code compilation may cause CRAN check errors StatCan servers otherwise temporarily unavailable","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-034","dir":"Changelog","previous_headings":"","what":"cansim 0.3.4","title":"cansim 0.3.4","text":"CRAN release: 2020-03-05","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-4","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.4","text":"Expand get_cansim_table_notes() functionality Add functionality access new cube list API","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-033","dir":"Changelog","previous_headings":"","what":"cansim 0.3.3","title":"cansim 0.3.3","text":"CRAN release: 2019-10-15","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.3","text":"Fix time zone problem parsing formatting times StatCan API","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-032","dir":"Changelog","previous_headings":"","what":"cansim 0.3.2","title":"cansim 0.3.2","text":"CRAN release: 2019-08-26","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-2","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.2","text":"Adjust package changes StatCan API different metadata format","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-031","dir":"Changelog","previous_headings":"","what":"cansim 0.3.1","title":"cansim 0.3.1","text":"CRAN release: 2019-08-19","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.3.1","text":"Fixes issues arising StatCan changing API row limit","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-1","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.1","text":"Optimize vector retrieval REF_DATE","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-030","dir":"Changelog","previous_headings":"","what":"cansim 0.3.0","title":"cansim 0.3.0","text":"CRAN release: 2019-07-18","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-3-0","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.3.0","text":"Fixes issues arising StatCan changing API Member Names come concatenated Classification Code default, break existing code. Adds option change fields factors Adds option strip Classification Codes fields Exposes timeout limit deal slow connections large tables","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-023","dir":"Changelog","previous_headings":"","what":"cansim 0.2.3","title":"cansim 0.2.3","text":"CRAN release: 2019-01-07","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"minor-changes-0-2-3","dir":"Changelog","previous_headings":"","what":"Minor changes","title":"cansim 0.2.3","text":"robust table download functions Improved documentation","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"cansim-022","dir":"Changelog","previous_headings":"","what":"cansim 0.2.2","title":"cansim 0.2.2","text":"CRAN release: 2018-12-18","code":""},{"path":"https://mountainmath.github.io/cansim/news/index.html","id":"major-changes-0-2-2","dir":"Changelog","previous_headings":"","what":"Major changes","title":"cansim 0.2.2","text":"Initial CRAN release French metadata implemented","code":""}] diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 0d8daa26..03bab8e0 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -22,9 +22,12 @@ https://mountainmath.github.io/cansim/reference/create_index.html https://mountainmath.github.io/cansim/reference/csv2arrow.html https://mountainmath.github.io/cansim/reference/csv2sqlite.html +https://mountainmath.github.io/cansim/reference/disconnect_cansim_connection.html https://mountainmath.github.io/cansim/reference/disconnect_cansim_sqlite.html https://mountainmath.github.io/cansim/reference/fold_in_metadata_for_columns.html https://mountainmath.github.io/cansim/reference/get_cansim.html +https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_coordinates.html +https://mountainmath.github.io/cansim/reference/get_cansim_changed_series_data_for_vectors.html https://mountainmath.github.io/cansim/reference/get_cansim_changed_tables.html https://mountainmath.github.io/cansim/reference/get_cansim_code_set.html https://mountainmath.github.io/cansim/reference/get_cansim_column_categories.html From 622123fc55edf7bf6ac0e2158addcdc664b6c94c Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Mon, 17 Aug 2026 16:39:43 -0700 Subject: [PATCH 55/59] Label named vectors in the changed series method however they are spelled get_cansim_changed_series_data_for_vectors() handed the caller's vectors on to rename_vectors() with the "v" prefix still attached, which looked labels up under "vv..." and matched nothing, so a named vector such as c(foo="v41690973") came back labelled with its id rather than with "foo". It now passes the naked vectors, whose names survive the stripping, the way get_cansim_vector() always has. The new tests pin the whole naming contract for both functions: either spelling of a named vector yields the caller's label, unnamed vectors get no label column, and the VECTOR column always carries the standardized "v" prefix whatever the caller typed. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01HqWZMTRqhbYA7UexPnZDPu --- R/cansim_changed_series.R | 4 +++- tests/testthat/helper-vector-data.R | 17 +++++++++++++++++ tests/testthat/test-changed-series.R | 22 ++++++++++++++++++++++ tests/testthat/test-vector-naming.R | 27 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/helper-vector-data.R create mode 100644 tests/testthat/test-vector-naming.R diff --git a/R/cansim_changed_series.R b/R/cansim_changed_series.R index d5985de4..8a73d1c5 100644 --- a/R/cansim_changed_series.R +++ b/R/cansim_changed_series.R @@ -129,8 +129,10 @@ get_cansim_changed_series_data_for_vectors <- function(vectors, language="englis naked_vectors <- gsub("^v","",vectors) # allow for leading "v" by conditionally stripping it bodies <- paste0('{"vectorId":',naked_vectors,'}') + # the naked vectors, which keep their names through the gsub above, are what rename_vectors() + # further down expects; handing it the prefixed originals would look up "vv..." and label nothing changed_series_data("https://www150.statcan.gc.ca/t1/wds/rest/getChangedSeriesDataFromVector", - bodies,vectors,language,timeout,factors,default_month,default_day) + bodies,naked_vectors,language,timeout,factors,default_month,default_day) } #' Retrieve data for series that changed, by table and coordinate diff --git a/tests/testthat/helper-vector-data.R b/tests/testthat/helper-vector-data.R new file mode 100644 index 00000000..2496f7bf --- /dev/null +++ b/tests/testthat/helper-vector-data.R @@ -0,0 +1,17 @@ +# A successful WDS data record of the shape every vector data method answers with, for tests that +# exercise the handling around the data rather than the data itself. The vectorId has to match the +# vector a test asks for, or the renaming the tests below cover would have nothing to match. +mock_vector_data_record <- function(vectorId=41690973, productId=18100004, + coordinate="2.2.0.0.0.0.0.0.0.0") { + list(status="SUCCESS", object=list( + responseStatusCode=0, vectorId=vectorId, productId=productId, coordinate=coordinate, + vectorDataPoint=list(list(refPer="2020-01-01", refPer2="", value=1, decimals=0, + scalarFactorCode=0, symbolCode=0, statusCode=0, + securityLevelCode=0, releaseTime="2020-01-01T08:30", + frequencyCode=12)))) +} + +# stands in for the per-table metadata lookup, which would otherwise ask StatCan +mock_metadata_for_coordinates <- function(cansimTableNumber, coordinates, language) { + tibble::tibble(cansimTableNumber=cansimTableNumber, COORDINATE=coordinates) +} diff --git a/tests/testthat/test-changed-series.R b/tests/testthat/test-changed-series.R index a91a0a46..e97f3d9c 100644 --- a/tests/testthat/test-changed-series.R +++ b/tests/testthat/test-changed-series.R @@ -138,3 +138,25 @@ test_that("requests are batched and shaped the way the API expects", { expect_match(bodies[1], '\\{"productId":34100013, "coordinate":"1\\.1\\.0\\.0\\.0\\.0\\.0\\.0\\.0\\.0"\\}') expect_match(bodies[1], '\\{"productId":34100013, "coordinate":"2\\.3\\.0\\.0\\.0\\.0\\.0\\.0\\.0\\.0"\\}') }) + +test_that("vectors come back standardized and named vectors keep their labels", { + changed_for <- function(vectors) { + suppressMessages(with_mocked_bindings( + get_cansim_changed_series_data_for_vectors(vectors, factors=FALSE), + post_with_timeout_retry=function(...) structure(list(), class="httr2_response"), + statcan_response_json=function(response) list(mock_vector_data_record(vectorId=990000777)), + metadata_for_coordinates=mock_metadata_for_coordinates, + .package="cansim")) + } + + # the caller may spell a vector with or without the "v" prefix, the result always carries it + expect_identical(changed_for("v990000777")$VECTOR, "v990000777") + expect_identical(changed_for("990000777")$VECTOR, "v990000777") + # and unnamed vectors get no label column + expect_false("label" %in% names(changed_for("v990000777"))) + + # rename_vectors() keys on the naked vector id, so both spellings of a named vector have to come + # out with the caller's label; the prefixed one used to look up "vv990000777" and label nothing + expect_identical(changed_for(c(foo="v990000777"))$label, "foo") + expect_identical(changed_for(c(foo="990000777"))$label, "foo") +}) diff --git a/tests/testthat/test-vector-naming.R b/tests/testthat/test-vector-naming.R new file mode 100644 index 00000000..6b7a3dc6 --- /dev/null +++ b/tests/testthat/test-vector-naming.R @@ -0,0 +1,27 @@ +# get_cansim_vector() accepts vectors with or without the "v" prefix and with or without names, and +# the four spellings have to come out the same: the VECTOR column always carries the prefix, and a +# name given by the caller always becomes the label of its rows. +test_that("vectors come back standardized and named vectors keep their labels", { + vector_for <- function(vectors) { + suppressMessages(with_mocked_bindings( + # refresh so a cache entry left by an earlier spelling, which strips to the same key, is not + # read in place of the mocked answer + get_cansim_vector(vectors, start_time="2020-01-01", end_time="2020-06-01", + factors=FALSE, refresh=TRUE), + get_with_timeout_retry=function(...) structure(list(), class="httr2_response"), + statcan_response_json=function(response) list(mock_vector_data_record(vectorId=990000778)), + metadata_for_coordinates=mock_metadata_for_coordinates, + .package="cansim")) + } + + # the caller may spell a vector with or without the "v" prefix, the result always carries it + expect_identical(vector_for("v990000778")$VECTOR, "v990000778") + expect_identical(vector_for("990000778")$VECTOR, "v990000778") + # and unnamed vectors get no label column + expect_false("label" %in% names(vector_for("v990000778"))) + + # rename_vectors() keys on the naked vector id, so both spellings of a named vector have to come + # out with the caller's label + expect_identical(vector_for(c(foo="v990000778"))$label, "foo") + expect_identical(vector_for(c(foo="990000778"))$label, "foo") +}) From f87dd58fd6a2270cda08cd1a5aac4c4ec347883f Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Mon, 17 Aug 2026 16:47:52 -0700 Subject: [PATCH 56/59] Take the default period count from the API bound rather than a guess Asking the latestN methods for all periods sent an arbitrary 1000000, which worked only because it happened to exceed the longest series. StatCan takes latestN as a signed 32-bit integer: zero or less comes back as "vector id or latest N is negative or zero", anything past 2147483647 as a JSON syntax error, and a count longer than the series is clamped to the whole series at no extra cost. The WDS user guide states none of this, it only requires latestN to be > 0, so the bound is recorded in a comment the way MAX_BATCH_SIZE already records the batching limit. MAX_PERIODS is now that bound. Being .Machine$integer.max it is also the largest value R can hold in an integer, so the coercion downstream can no longer overshoot what the endpoint accepts. The same call sites coerced with as.integer(), which turns anything above the 32-bit range, Inf included, into NA with only a warning and pasted "latestN":NA into the request body. clean_periods() now caps those instead, and refuses a count below one outright rather than sending a request that is certain to earn an HTTP 406. It is vectorized, so it also covers the per-coordinate periods column of a table template, which previously got a coalesce() on NA and no range check at all. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01HqWZMTRqhbYA7UexPnZDPu --- NEWS.md | 8 ++++++ R/cansim_vectors.R | 29 ++++++++++++++++----- tests/testthat/test-vector-periods.R | 38 ++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 tests/testthat/test-vector-periods.R diff --git a/NEWS.md b/NEWS.md index c02dc4d1..e8ba939d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -159,6 +159,14 @@ cube metadata are reported once per member rather than once per coordinate that uses it ## Minor changes +* asking `get_cansim_vector_for_latest_periods()` or `get_cansim_data_for_table_coord_periods()` for + all periods no longer sends an arbitrary round number as the period count. StatCan takes `latestN` + as a signed 32-bit integer, rejecting zero or less and anything past 2147483647, and quietly clamps + a count longer than the series to the whole series, so the default is now that bound as the + API itself enforces it, rather than a guess that happened to exceed the longest series. A period count larger than + the bound, or an infinite one, is capped instead of being silently coerced to `NA` and sent to + StatCan as `"latestN":NA`, and a count below one now fails immediately with a message instead of + earning an HTTP 406. This also applies to the per-coordinate `periods` column of a table template * an unrecognized `language` argument is now an error naming what was passed, instead of an `NA` that travelled on into a cache directory name or the tail of a StatCan URL and surfaced later as a download failure or a missing column. Either language can be named in either language, so diff --git a/R/cansim_vectors.R b/R/cansim_vectors.R index dfa63b6b..c72de3e4 100644 --- a/R/cansim_vectors.R +++ b/R/cansim_vectors.R @@ -1,4 +1,23 @@ -MAX_PERIODS = 1000000L +# The latestN methods take the period count as a signed 32-bit integer. The API rejects zero or less +# with "vector id or latest N is negative or zero" and anything above 2147483647 with a JSON syntax +# error, while a count longer than the series is silently clamped to the whole series at no extra cost. +# Asking for every period is therefore best expressed as the largest value the API will accept, which +# is also the largest value R can hold in an integer, so as.integer() can never overshoot it. Neither +# the bound nor the clamping is stated in the WDS user guide, which only requires latestN to be > 0. +MAX_PERIODS <- .Machine$integer.max + +# Coerce a user supplied period count to something the latestN methods accept. Missing, infinite and +# over-long counts all mean "every period there is"; a count below one has no reading that the API +# would honour, so it is refused here rather than sent off to earn an HTTP 406. +clean_periods <- function(periods) { + if (is.null(periods) || length(periods) == 0) return(MAX_PERIODS) + periods <- suppressWarnings(as.numeric(periods)) + if (any(!is.na(periods) & periods < 1)) { + stop("The number of periods to retrieve must be at least 1.") + } + periods[is.na(periods) | periods > MAX_PERIODS] <- MAX_PERIODS + as.integer(periods) +} STATCAN_TIMEZONE = "America/Toronto" STATCAN_TIME_FORMAT="%Y-%m-%dT%H:%M" STATCAN_TIME_FORMAT_S="%Y-%m-%dT%H:%M:%S" @@ -384,8 +403,7 @@ get_cansim_vector_for_latest_periods<-function(vectors, periods=NULL, language="english", refresh = FALSE, timeout = 200, factors = TRUE, default_month = "07", default_day = "01"){ - if (is.null(periods) || is.na(periods)) {periods <- MAX_PERIODS} - periods <- as.integer(periods) + periods <- clean_periods(periods) cleaned_language <- cleaned_ndm_language(language) vectors=gsub("^v","",vectors) # allow for leading "v" by conditionally stripping it @@ -462,8 +480,7 @@ get_cansim_data_for_table_coord_periods<-function(tableCoordinates, periods=NULL refresh = FALSE, timeout = 200, factors=TRUE, default_month="07", default_day="01"){ CENSUS_TABLE_STARTING_STRING <- "9810" - if (is.null(periods) || is.na(periods)) {periods <- MAX_PERIODS} - periods <- as.integer(periods) + periods <- clean_periods(periods) # pad coordinate if needed if ("list" %in% class(tableCoordinates)) { @@ -485,7 +502,7 @@ get_cansim_data_for_table_coord_periods<-function(tableCoordinates, periods=NULL mutate(periods = !!periods) } else { tableCoordinates <- tableCoordinates %>% - mutate(periods = coalesce(.data$periods, MAX_PERIODS)) + mutate(periods = clean_periods(.data$periods)) } tableCoordinates <- tableCoordinates %>% diff --git a/tests/testthat/test-vector-periods.R b/tests/testthat/test-vector-periods.R new file mode 100644 index 00000000..41082eed --- /dev/null +++ b/tests/testthat/test-vector-periods.R @@ -0,0 +1,38 @@ +test_that("the default period count is the largest value the latestN methods accept", { + # StatCan rejects a latestN above the signed 32-bit maximum with a JSON syntax error, so the + # default has to sit exactly on that bound rather than at an arbitrary large round number. + expect_identical(cansim:::MAX_PERIODS, .Machine$integer.max) + expect_identical(cansim:::MAX_PERIODS, as.integer(cansim:::MAX_PERIODS)) +}) + +test_that("clean_periods treats an absent count as every period", { + expect_identical(cansim:::clean_periods(NULL), cansim:::MAX_PERIODS) + expect_identical(cansim:::clean_periods(NA), cansim:::MAX_PERIODS) + expect_identical(cansim:::clean_periods(NA_integer_), cansim:::MAX_PERIODS) + expect_identical(cansim:::clean_periods(integer(0)), cansim:::MAX_PERIODS) +}) + +test_that("clean_periods caps counts that the API could not encode", { + expect_identical(cansim:::clean_periods(Inf), cansim:::MAX_PERIODS) + expect_identical(cansim:::clean_periods(1e10), cansim:::MAX_PERIODS) + # as.integer() alone would silently turn these into NA and send "latestN":NA to StatCan + expect_false(is.na(cansim:::clean_periods(1e10))) +}) + +test_that("clean_periods keeps an explicit count and stays vectorized", { + expect_identical(cansim:::clean_periods(10), 10L) + expect_identical(cansim:::clean_periods(c(5, NA, 1e10, 2)), + c(5L, cansim:::MAX_PERIODS, cansim:::MAX_PERIODS, 2L)) +}) + +test_that("clean_periods refuses a count the API would reject outright", { + expect_error(cansim:::clean_periods(0), "at least 1") + expect_error(cansim:::clean_periods(-4), "at least 1") + expect_error(cansim:::clean_periods(c(3, 0)), "at least 1") +}) + +test_that("the default period count serializes into the request body as a plain integer", { + # a double default would paste as 2.147484e+09 and break the JSON body + expect_identical(paste0('"latestN":', cansim:::clean_periods(NULL)), + '"latestN":2147483647') +}) From 1a806299f2342bed569a99d6921a7631b6a87f05 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Tue, 18 Aug 2026 08:09:38 -0700 Subject: [PATCH 57/59] Export the changed series list method after all The 504 that held this back is a function of how much StatCan released that morning rather than a fault in the method. Today it answered in 0.35 seconds with 58 series across three tables, and everything about that answer checks out: the three tables are exactly the ones get_cansim_changed_tables() reports for the same release time, all 58 vectors come back from getChangedSeriesDataFromVector, and the 27 coordinates listed for 33-10-0036 come back from the coordinate method as the same set of vectors. Today's payload also arrives in the unwrapped shape, so the branch reading series straight out of `object` is confirmed against real data and not only against the recorded one. So the method works, it is just at the mercy of the day. That is worth documenting rather than worth withholding a function over, and the alternative on a heavy day is the coarser question get_cansim_changed_tables() answers, which the docs now point at. The `timeout` parameter stays and is documented: it defaults high because the method is silent while it works, so a genuine gateway timeout arrives as StatCan's own 504 rather than as a vaguer local abort, but the limit being hit is at StatCan's end and raising it further does nothing. The method takes no parameters, so a busy day cannot be asked about in smaller pieces. Co-Authored-By: Claude Opus 5 --- NAMESPACE | 1 + NEWS.md | 22 ++++++------ R/cansim_changed_series.R | 48 +++++++++++++++++---------- man/get_cansim_changed_series_list.Rd | 42 +++++++++++++++++++++++ pkgdown/_pkgdown.yml | 1 + tests/testthat/test-changed-series.R | 8 ++--- 6 files changed, 91 insertions(+), 31 deletions(-) create mode 100644 man/get_cansim_changed_series_list.Rd diff --git a/NAMESPACE b/NAMESPACE index 8f6526d3..4069dd8f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,6 +11,7 @@ export(disconnect_cansim_sqlite) export(get_cansim) export(get_cansim_changed_series_data_for_coordinates) export(get_cansim_changed_series_data_for_vectors) +export(get_cansim_changed_series_list) export(get_cansim_changed_tables) export(get_cansim_code_set) export(get_cansim_column_categories) diff --git a/NEWS.md b/NEWS.md index e8ba939d..9a2ece7a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -81,19 +81,21 @@ says that StatCan builds a whole response before sending any of it, so the way past a gateway timeout is to ask for less at once rather than to retry the same request -* two new functions expose StatCan's changed series data methods, which report what changed at a finer - grain than `get_cansim_changed_tables()` does. `get_cansim_changed_series_data_for_vectors()` and - `get_cansim_changed_series_data_for_coordinates()` retrieve the data points StatCan changed, in +* three new functions expose StatCan's changed series methods, which report what changed at a finer + grain than `get_cansim_changed_tables()` does. `get_cansim_changed_series_list()` lists the series + StatCan changed today as vectors, with the table and coordinate each belongs to, and + `get_cansim_changed_series_data_for_vectors()` and + `get_cansim_changed_series_data_for_coordinates()` retrieve the changed data points themselves, in the same shape and with the same metadata as the corresponding `get_cansim_vector()` and coordinate calls. Series that did not change simply contribute no rows, and if none of the ones asked about changed the answer is an empty table rather than an error. Like the other vector - methods they batch requests of more than 300 items. - StatCan's third changed series method, the one listing every series that changed today, is - implemented but not exported. It regularly fails to answer at all: StatCan works out the whole - response before sending any of it, and with the changed series numbering in the hundreds of - thousands the request outlives StatCan's own gateway and comes back as an HTTP 504 after some nine - minutes of silence. Exporting it will wait until it is clear whether that is a fault or simply how - the method behaves + methods the two data ones batch requests of more than 300 items. + How long the list method takes is entirely a matter of how much StatCan released that morning. It + takes no parameters, so a busy day cannot be asked about in smaller pieces, and on one heavy enough + the request has been seen to outlive StatCan's own gateway and come back as an HTTP 504 after some + nine minutes of silence. Its `timeout` defaults high to let that answer arrive as StatCan's own + rather than as a vaguer local abort, but the limit is at StatCan's end and raising it further will + not help; `get_cansim_changed_tables()` is the question to ask on such a day * the package now talks to StatCan through `httr2` rather than `httr`. Requests that fail on a status StatCan recovers from within seconds, an HTTP 429, 500, 502 or 504, are now retried with diff --git a/R/cansim_changed_series.R b/R/cansim_changed_series.R index 8a73d1c5..37c74a0b 100644 --- a/R/cansim_changed_series.R +++ b/R/cansim_changed_series.R @@ -4,23 +4,37 @@ # rather than as the failure the shared handling would otherwise make of it. CHANGED_SERIES_NO_DATA_STATUS <- 404L -# Retrieve the list of data series StatCan changed today, as vectors together with the table and -# coordinate they belong to. StatCan serves this for the current day only and fills it during the -# daily update window that ends at 8:30am Eastern. Unlike the changed tables method there is no way to -# ask for an earlier day, StatCan answers a request naming a date with an HTTP 404. -# -# This is deliberately not exported yet. The method is frequently unable to answer at all: StatCan -# works out the whole response before sending any of it, and the series changing on a given day can -# number in the hundreds of thousands, so the request regularly outlives StatCan's own gateway and -# comes back as an HTTP 504 after some nine minutes of silence. Raising `timeout` does not help, the -# limit being exceeded is at StatCan's end. Until it is clear whether that is a fault worth working -# around or simply how the method behaves, exporting it would be handing users something that mostly -# does not work, and `get_cansim_changed_tables()` answers the coarser version of the same question in -# a fraction of a second. The plan is to watch it for a while and export it in a later release once -# there is a clear picture of what to expect. -# -# `timeout` is the number of seconds StatCan may go without sending data before the call is -# abandoned, and is set high because this method is silent while it works. +#' Retrieve the series that changed today +#' +#' Retrieve the list of data series Statistics Canada changed today, as vectors together with the +#' table and coordinate they belong to. Where \code{get_cansim_changed_tables()} reports which tables +#' were touched, this reports the individual series inside them, which is the finer grained way to +#' decide what needs re-downloading. +#' +#' StatCan serves this for the current day only and fills it during the daily update window that ends +#' at 8:30am Eastern. Unlike the changed tables method there is no way to ask for an earlier day, +#' StatCan answers a request naming a date with an HTTP 404. +#' +#' How long this takes depends entirely on how much StatCan released that morning. The method takes no +#' parameters, so there is no way to ask for a smaller slice of a busy day, and StatCan works out a +#' whole response before sending any of it. On a quiet day the answer arrives in well under a second; +#' on a heavy one the series changing can number in the hundreds of thousands and the request has been +#' seen to outlive StatCan's own gateway, coming back as an HTTP 504 after some nine minutes of +#' silence. That is a limit at StatCan's end which raising \code{timeout} cannot lift, so on such a day +#' \code{get_cansim_changed_tables()} is the question worth asking instead. +#' +#' @param timeout (Optional) Number of seconds StatCan is allowed to go without sending data before +#' the download is abandoned. The default is set high because this method is silent while it works. +#' +#' @return A tibble with one row per changed series, carrying the vector, the table number, the +#' coordinate and the release time +#' +#' Returns \code{NULL} if the data could not be retrieved because StatCan is unavailable. +#' @examples +#' \dontrun{ +#' get_cansim_changed_series_list() +#' } +#' @export get_cansim_changed_series_list <- function(timeout=600){ url <- "https://www150.statcan.gc.ca/t1/wds/rest/getChangedSeriesList" diff --git a/man/get_cansim_changed_series_list.Rd b/man/get_cansim_changed_series_list.Rd new file mode 100644 index 00000000..87001b8c --- /dev/null +++ b/man/get_cansim_changed_series_list.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cansim_changed_series.R +\name{get_cansim_changed_series_list} +\alias{get_cansim_changed_series_list} +\title{Retrieve the series that changed today} +\usage{ +get_cansim_changed_series_list(timeout = 600) +} +\arguments{ +\item{timeout}{(Optional) Number of seconds StatCan is allowed to go without sending data before +the download is abandoned. The default is set high because this method is silent while it works.} +} +\value{ +A tibble with one row per changed series, carrying the vector, the table number, the +coordinate and the release time + +Returns \code{NULL} if the data could not be retrieved because StatCan is unavailable. +} +\description{ +Retrieve the list of data series Statistics Canada changed today, as vectors together with the +table and coordinate they belong to. Where \code{get_cansim_changed_tables()} reports which tables +were touched, this reports the individual series inside them, which is the finer grained way to +decide what needs re-downloading. +} +\details{ +StatCan serves this for the current day only and fills it during the daily update window that ends +at 8:30am Eastern. Unlike the changed tables method there is no way to ask for an earlier day, +StatCan answers a request naming a date with an HTTP 404. + +How long this takes depends entirely on how much StatCan released that morning. The method takes no +parameters, so there is no way to ask for a smaller slice of a busy day, and StatCan works out a +whole response before sending any of it. On a quiet day the answer arrives in well under a second; +on a heavy one the series changing can number in the hundreds of thousands and the request has been +seen to outlive StatCan's own gateway, coming back as an HTTP 504 after some nine minutes of +silence. That is a limit at StatCan's end which raising \code{timeout} cannot lift, so on such a day +\code{get_cansim_changed_tables()} is the question worth asking instead. +} +\examples{ +\dontrun{ +get_cansim_changed_series_list() +} +} diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 607ef41b..c138ad97 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -36,6 +36,7 @@ reference: - get_cansim_changed_tables - get_cansim_table_last_release_date - get_cansim_key_release_schedule + - get_cansim_changed_series_list - get_cansim_changed_series_data_for_vectors - get_cansim_changed_series_data_for_coordinates - title: Metadata and information diff --git a/tests/testthat/test-changed-series.R b/tests/testthat/test-changed-series.R index e97f3d9c..e0e4e1f0 100644 --- a/tests/testthat/test-changed-series.R +++ b/tests/testthat/test-changed-series.R @@ -41,7 +41,7 @@ test_that("both record shapes of the changed series list are read", { read <- function(payload) { with_mocked_bindings( - cansim:::get_cansim_changed_series_list(), + get_cansim_changed_series_list(), get_with_timeout_retry=function(...) structure(list(), class="httr2_response"), statcan_response_json=function(response) payload, .package="cansim") @@ -79,7 +79,7 @@ test_that("nothing having changed is an empty table rather than a failure", { # the list method says the same when StatCan answers with no series, which it reports in the body # rather than through a status listed <- with_mocked_bindings( - cansim:::get_cansim_changed_series_list(), + get_cansim_changed_series_list(), get_with_timeout_retry=function(...) structure(list(), class="httr2_response"), statcan_response_json=function(response) list(status="SUCCESS", object=list()), .package="cansim") @@ -93,7 +93,7 @@ test_that("the list method does not ask for a 404 to be read as nothing having c # rather than being passed off as a quiet day empty_status <- NULL with_mocked_bindings( - cansim:::get_cansim_changed_series_list(), + get_cansim_changed_series_list(), get_with_timeout_retry=function(url, ...) { empty_status <<- list(...)$empty_status; NULL }, .package="cansim") @@ -103,7 +103,7 @@ test_that("the list method does not ask for a 404 to be read as nothing having c test_that("StatCan being unavailable still yields NULL", { unavailable <- function(...) NULL - expect_null(with_mocked_bindings(cansim:::get_cansim_changed_series_list(), + expect_null(with_mocked_bindings(get_cansim_changed_series_list(), get_with_timeout_retry=unavailable, .package="cansim")) expect_null(suppressMessages( with_mocked_bindings(get_cansim_changed_series_data_for_vectors("v1"), From a89f3651892c181184548f716c820a064e42b5ab Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Tue, 18 Aug 2026 21:05:49 -0700 Subject: [PATCH 58/59] version bump --- DESCRIPTION | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8457b4a9..ee2a8dd2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: cansim Type: Package Title: Accessing Statistics Canada Data Table and Vectors -Version: 0.4.5 +Version: 0.5.0 Authors@R: c( person("Jens", "von Bergmann", email = "jens@mountainmath.ca", role = c("aut","cre")), person("Dmitry", "Shkolnik", email = "shkolnikd@gmail.com", role = c("aut"))) diff --git a/README.md b/README.md index 34051417..0c2173b8 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ If you want to get in touch, we are pretty good at responding via email or via t If you wish to cite the `cansim` package in your work: - von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.4. DOI: 10.32614/CRAN.package.cansim + von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.5.0. DOI: 10.32614/CRAN.package.cansim A BibTeX entry for LaTeX users is @@ -243,7 +243,7 @@ A BibTeX entry for LaTeX users is title = {cansim: functions and convenience tools for accessing Statistics Canada data tables}, year = {2025}, doi = {10.32614/CRAN.package.cansim}, - note = {R package version 0.4.4}, + note = {R package version 0.5.0}, url = {https://mountainmath.github.io/cansim/} } ``` From 1e8f90d9c23c2ad6dc29828a111b3ec0ba4f9177 Mon Sep 17 00:00:00 2001 From: Jens von Bergmann Date: Tue, 18 Aug 2026 21:10:39 -0700 Subject: [PATCH 59/59] regenerate docs, getting ready for CRAN once they come back from their holiday --- docs/404.html | 14 +- docs/LICENSE-text.html | 12 +- docs/LICENSE.html | 12 +- docs/articles/cansim.html | 14 +- docs/articles/index.html | 12 +- docs/articles/listing_cansim_tables.html | 14 +- .../articles/partial_table_data_download.html | 14 +- docs/articles/retrieving_cansim_vectors.html | 14 +- docs/articles/working_with_hierarchies.html | 14 +- docs/articles/working_with_large_tables.html | 62 ++++---- docs/articles/working_with_large_tables.md | 48 +++--- docs/authors.html | 12 +- docs/deps/bootstrap-5.3.8/bootstrap.min.css | 2 +- docs/index.html | 24 ++- docs/index.md | 4 +- docs/llms.txt | 6 +- docs/news/index.html | 17 ++- docs/news/index.md | 45 ++++-- docs/pkgdown.yml | 2 +- .../add_cansim_vectors_to_template.html | 14 +- .../add_provincial_abbreviations.html | 12 +- docs/reference/cansim_old_to_new.html | 12 +- .../cansim_repartition_cached_table.html | 12 +- docs/reference/categories_for_level.html | 12 +- docs/reference/collect_and_normalize.html | 12 +- docs/reference/correspondence.html | 12 +- docs/reference/create_index.html | 12 +- docs/reference/csv2arrow.html | 12 +- docs/reference/csv2sqlite.html | 12 +- .../disconnect_cansim_connection.html | 12 +- docs/reference/disconnect_cansim_sqlite.html | 12 +- .../fold_in_metadata_for_columns.html | 12 +- docs/reference/get_cansim.html | 12 +- ...m_changed_series_data_for_coordinates.html | 12 +- ...ansim_changed_series_data_for_vectors.html | 12 +- .../get_cansim_changed_series_list.html | 143 ++++++++++++++++++ .../get_cansim_changed_series_list.md | 57 +++++++ docs/reference/get_cansim_changed_tables.html | 12 +- docs/reference/get_cansim_code_set.html | 12 +- .../get_cansim_column_categories.html | 12 +- docs/reference/get_cansim_column_list.html | 12 +- docs/reference/get_cansim_connection.html | 12 +- docs/reference/get_cansim_cube_metadata.html | 12 +- ...t_cansim_data_for_table_coord_periods.html | 12 +- .../get_cansim_key_release_schedule.html | 12 +- .../get_cansim_series_info_cube_coord.html | 12 +- docs/reference/get_cansim_sqlite.html | 12 +- docs/reference/get_cansim_table_info.html | 12 +- .../get_cansim_table_last_release_date.html | 12 +- docs/reference/get_cansim_table_notes.html | 12 +- docs/reference/get_cansim_table_overview.html | 12 +- .../get_cansim_table_short_notes.html | 12 +- docs/reference/get_cansim_table_subject.html | 12 +- docs/reference/get_cansim_table_survey.html | 12 +- docs/reference/get_cansim_table_template.html | 12 +- docs/reference/get_cansim_table_url.html | 12 +- docs/reference/get_cansim_vector.html | 12 +- .../get_cansim_vector_for_latest_periods.html | 12 +- docs/reference/get_cansim_vector_info.html | 12 +- .../get_deduped_column_level_data.html | 12 +- docs/reference/index.html | 19 ++- docs/reference/index.md | 2 + docs/reference/list_cansim_cached_tables.html | 12 +- docs/reference/list_cansim_cubes.html | 12 +- .../list_cansim_sqlite_cached_tables.html | 12 +- docs/reference/list_cansim_tables.html | 12 +- docs/reference/normalize_cansim_values.html | 12 +- docs/reference/parse_metadata.html | 12 +- .../remove_cansim_cached_tables.html | 12 +- .../remove_cansim_sqlite_cached_table.html | 12 +- docs/reference/search_cansim_cubes.html | 12 +- docs/reference/search_cansim_tables.html | 12 +- docs/reference/set_cansim_cache_path.html | 12 +- docs/reference/show_cansim_cache_path.html | 12 +- docs/reference/view_cansim_webpage.html | 12 +- docs/search.json | 2 +- docs/sitemap.xml | 1 + pkgdown/_pkgdown.yml | 1 + 78 files changed, 920 insertions(+), 273 deletions(-) create mode 100644 docs/reference/get_cansim_changed_series_list.html create mode 100644 docs/reference/get_cansim_changed_series_list.md diff --git a/docs/404.html b/docs/404.html index c8cdae41..ea9d4aa4 100644 --- a/docs/404.html +++ b/docs/404.html @@ -11,7 +11,7 @@ - + @@ -34,11 +34,11 @@ Skip to contents -