You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
paste0(.data$...name," [",.data$...id,"]"), # deals with 36-10-0108
469
-
.data$...name)) %>%
470
-
mutate(...count=n(),.by="...name") %>%
471
-
mutate(...duplicated=.data$...count>1)
467
+
mutate(...last_parent_id=.data$...parent_id)
468
+
469
+
fixed_level_table<-NULL
470
+
# don't try to dedup census geographies, too messy
471
+
if (substr(naked_ndm_table_number(cansimTableNumber),1,4)=="9810"&& sum(filter(level_table,.data$...dim=="1")$...duplicated)>0) {
472
+
warning(paste0("Table ",cansimTableNumber," is a census data table that has duplicate geography names, not converting to factors. Treat with caution when accessng geographies by name and check geographic identifiers."))
473
+
fixed_level_table<-level_table %>%
474
+
filter(.data$...dim=="1")
475
+
level_table<-level_table %>%
476
+
filter(.data$...dim!="1")
477
+
}
472
478
479
+
# try to dedup
473
480
max_run<-30
474
481
while (sum(level_table$...duplicated)>0&&max_run>0) { # deals with 36-10-0580
@@ -219,19 +220,17 @@ If you want to get in touch, we are pretty good at responding via email or via t
219
220
220
221
### Related packages
221
222
222
-
* The [CANSIM2R package](https://CRAN.R-project.org/package=CANSIM2R) provides functionality to download entire StatCan tables.
223
-
224
-
* The [statcanR package](https://CRAN.R-project.org/package=statcanR) provides functionality to download entire StatCan tables and basic data discovery functionality.
225
-
226
-
*[CANSIM-dataviewer](https://github.com/bcgov/CANSIM-dataviewer) is another tool that depends on the existing *CANSIM2R* package with a focus on uses for the Province of British Columbia.
223
+
* The [statcanR package](https://CRAN.R-project.org/package=statcanR) is an alternative package providing basic access to StatCan NDM tables and data discovery.
227
224
228
225
*[cancensus](https://github.com/mountainMath/cancensus) is a package designed to access, retrieve, and work with Canadian Census data and geography. The *cansim* package is designed to work in conjunction with *cancensus* and data can easily be joined on standard geographic identifiers exposed and harmonized by both packages.
229
226
227
+
*[cmhc](https://github.com/mountainMath/cmhc) is a package designed to access, retrieve, and work with CMHC data.
228
+
230
229
### Cite cansim
231
230
232
231
If you wish to cite the `cansim` package in your work:
233
232
234
-
von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.2. DOI: 10.32614/CRAN.package.cansim
233
+
von Bergmann, J., Dmitry Shkolnik (2024). cansim: functions and convenience tools for accessing Statistics Canada data tables. v0.4.3. DOI: 10.32614/CRAN.package.cansim
235
234
236
235
A BibTeX entry for LaTeX users is
237
236
@@ -241,7 +240,7 @@ A BibTeX entry for LaTeX users is
241
240
title = {cansim: functions and convenience tools for accessing Statistics Canada data tables},
0 commit comments