Reproducibility issue in get_census_geometry
dshkol opened this issue · comments
Just ran into some errors trying to recompile old code. Reprex below:
dataset <- "CA16"
regions_list10 <- list_census_regions(dataset) %>%
filter(level=="CMA") %>%
top_n(10,pop) %>%
as_census_region_list
csd_geo <- get_census_geometry(dataset, level = 'Regions', regions = regions_list10)
csd_geo <- get_census_geometry(dataset, level = 'CSD', regions = regions_list10)
csd_geo <- get_census_geometry(dataset, level = 'CD', regions = regions_list10)
csd_geo <- get_census_geometry(dataset, level = 'CMA', regions = regions_list10)
Each of the get_census_geometry
calls here fails with the error
Error in get_census(dataset, level, regions, vectors = c(), geo_format = geo_format, :
thelevel
parameter must be one of 'Regions', 'PR', 'CMA', 'CD', 'CSD', 'CT', or 'DA'
In addition: Warning message:
In get_census(dataset, level, regions, vectors = c(), geo_format = geo_format, :
passingregions
as a character vector is depreciated, and will be removed in future versions
Flagging this to figure out what is causing the issue and if its a deprecation issue think about it making it a softer deprecation for legacy code.
The original code was written pre-CRAN release.
I feel like we should remove that function. Ok keep and mark as deprecated. get_census
is the function that should be used.
Agreed we can deprecate, but would rather soft deprecate it by keeping it working. In this case, it throws an error.
Do you get the same error?
Yes. I fixed the error in https://github.com/mountainMath/cancensus/tree/list-region-fix, the order of arguments in get_census
changed and get_census_geometry
relied on variable order.