set_cancensus_api_key() and set_cancensus_cache_path() with overwrite = TRUE, install = TRUE no longer truncate the user's .Renviron when it does not already contain the corresponding keyget_statcan_wds_data() no longer caches error response bodies as data, and refresh = TRUE now bypasses the data cache as documentedremove_recalled_cached_data() no longer over-matches recalled vector IDs (e.g. a recall of v_CA21_1 no longer also flags cached data for v_CA21_10)get_census() now warns about recalled data when reading tabular data from the local cache, matching the geometry pathparent_census_vectors() and child_census_vectors() now stop with "Unable to determine dataset" for mixed-dataset input instead of silently dropping vectorsfind_census_vectors() exact search now matches queries containing regex metacharacters (e.g. "income ($)") literally instead of erroring or silently failingfind_census_vectors() semantic search now considers the best match for every query word (previously only the full phrase), and restores suffix n-grams dropped in 0.6.0find_census_vectors() keyword search no longer matches every vector when the query starts with a digit or punctuationvisualize_vector_hierarchy() accepts multi-vector character input as documented, and no longer labels nodes truncated by max_depth as leaves (now marked with ...)add_unique_names_to_region_list() now correctly preserves grouping of grouped inputlist_census_datasets() and list_census_regions() staleness warnings now respect quiet = TRUERetry-After headerslist_census_vectors() and list_census_regions(): repeated calls within a session no longer re-read and deserialize the cached file on every access (cache hits are ~1000x faster)parent_census_vectors() and child_census_vectors() use a hash-based BFS traversal, 4-8x faster on deep hierarchies on top of the 0.6.0 improvements, with identical outputfind_census_vectors() semantic search prunes fuzzy-match candidates by length bound before computing Levenshtein distancesget_census() no longer scans the package library (installed.packages()) on spatial callsget_statcan_wds_metadata() parent ID extraction is vectorized (~5-10x faster metadata parsing for large levels such as DA)Significant performance improvements to census vector hierarchy traversal functions
parent_census_vectors() is now 1.9x faster (92% speedup) by caching the full vector list once instead of repeated lookupschild_census_vectors() is now 1.2x faster (23% speedup) with same optimizationFaster semantic search in find_census_vectors()
tests/testthat/ directory structuremicrobenchmark and testthat to Suggestsvisualize_vector_hierarchy())list_census_regions()sf package when user requests spatial data but does not have the required package installed as opposed to erroring out.sf package when user requests spatial data but does not have the required package installed as opposed to stopping with an error.get_census call that produces a warning if locally cached data has been recalled by Statistics Canadaget_censussf compatibility and agr attributekeep_parent when calling child_census_vectors() that retains the input parent variable in the list of result. We found that in many cases user would follow up a call to child_census_vectors() with a bind_rows(...) to do this, so this should save a step.t column not present in downloaded data.get_intersecting_geometry function to take advantage of new Censusmapper API endpoint. Check out the new vignette detailing how to use it.set_api_key, set_cache_path, show_api_key, and show_cache_path added.find_census_vectors()find_census_vectors() and deprecation of `search_census_vectors(). See the Data discovery: resources for finding available and relevant data vignette for additional information.list_census_regions()list_census_datasets()explore_census_regions and explore_census_vectors which open a browser page towards the interactive discovery and selection tools on the Censusmapper websiteattribution_for_dataset which provides accurate attribution information for citation and visualizations for a given dataset.get_census_geometry() is now hard-deprecated and will stop the program flow. Use get_census() instead.sp and sf spatial objectsgeojsonsf dependencymax_leaves_option for the search_census_vectors function. Adds functionality to set maximum depth for child census vectors, i.e. max_level=NA as an additional parameter. Then e.g. max_level=1 would only get direct children and no grandchildren.get_census_geography is now soft deprecated and rolled into the standard get_census with parametersreadr packagesf and ggplot2 packagessftempdir()options(cancensus.cache_path = 'XXX')sf-class data frames if option sf was selected for spatial data.read.csv was incorrectly loading text data if readr::read_csv was not availableNEWS.md file to track changes to the package.list_census_vectors() changed to have quiet = TRUE