cancensus 0.6.3

Bug fixes

Improvements

get_census() returns Statistics Canada’s Dissemination Geography Unique Identifier in a new DGUID column after GeoUID, now that the CensusMapper API provides it (#238). Regions without a DGUID, like those of CA1116, get NA. Data cached before doesn’t have the column, use_cache = FALSE downloads it again.

get_statcan_geographies() downloads 2026 boundary files with census_year = "2026", including the new census agricultural region ("CAR") and census consolidated subdivision ("CCS") files. Statistics Canada hasn’t released all of them yet: "CMACA", "CT", "POPCNTR" and "DPL" are planned for February 10, 2027, and "FSA" for September 28, 2027, and asking for them before then gives an error with the date. A new precision argument selects between "detailed" (the default) and the new "generalized" cartographic boundary files, which are only available from 2026 on.

The deprecated get_statcan_geography_relationships() also reads the 2026 relationship file, since the 2026 GeoSuite and geographic attributes aren’t available yet. The 2026 file doesn’t have census metropolitan areas and census agglomerations, census tracts, population centres and designated places yet, Statistics Canada plans to release these on February 10, 2027.

CODES_TABLE has the census division and census subdivision types of all censuses from 1981 to 2026, adding the types that were missing.

get_statcan_geographies() gets past Statistics Canada’s Cloudflare browser verification by sending a real browser through it with the new safeconduct package, where that is installed and finds Google Chrome or another Chromium-based browser. safeconduct is suggested, not required. Without it, or when the browser doesn’t get through, e.g. where a verification asks for a click and no one is there to give it, the warning explaining how to download the file manually is shown as before, now with a note on how to have this done automatically. options(cancensus.use_browser = FALSE) turns the browser off.

A new geom_cm_context() function that adds a context layer to a census map similar to what CensusMapper does. The base map tiles need a CensusMapper API key, taken from set_cancensus_api_key() (the CM_API_KEY environment variable) when the tiles are fetched, and count against a separate tile quota. Without an API key the map is drawn without the base map, with a warning. Refused tile requests (invalid or inactive key, exceeded tile quota) stop with an error instead of leaving the base map empty (#236).

A new cm_context() function returns the features of the CensusMapper base map (water, landcover, landuse, airports, buildings, roads, places and road labels) for an sf object or bounding box as a list of sf data frames, for styling them differently or using them with other mapping packages.

New functions cm_gini(), cm_gini2(), cm_binned_quantile() and cm_wasserstein() compute CensusMapper’s gini(), gini2(), binned_quantile() and wasserstein() per region, e.g. inside dplyr::mutate(), for reproducing CensusMapper maps in R. cm_wasserstein() needs the transport package. They stop with an error when the number of cutoffs doesn’t match the number of brackets, instead of recycling them.

A new coord_cm_bbox() limits a ggplot map to a bounding box in any CRS, e.g. the view of a CensusMapper map, and shows all data with bbox = NULL. geom_cm_context() covers the area the plot shows, following coord_cm_bbox() or coord_sf() limits, and is drawn in the plot’s CRS whatever CRS the data are in.

New scale_fill_cm_bins() and scale_colour_cm_bins() scales for choropleth maps bin numeric values at given cutoffs (or at quantiles), colour the bins from a ColorBrewer, viridis or hcl.colors() palette, and label them with formatted ranges for numbers, percentages, ratios or currency, in English or French. Like scale_fill_manual(), values and labels set the colours and labels directly. The legend shows every bin, including bins without data.

A new geom_cm_tricolore() maps compositions of three parts, e.g. the shares of children, working age population and seniors, in the colours of CensusMapper’s ternary (“rgb”) maps, with a triangular colour key that shows the regions as dots. cm_tricolore() gives just the colours. They are the colours of the tricolore package, with the parameters in the units of CensusMapper’s tricolore_options, computed without needing tricolore or ggtern.

Like get_census(), geom_cm_context(), cm_context() and scale_fill_cm_bins() take a language argument for their labels that defaults to the cancensus.language option.

cancensus 0.6.2

Breaking changes

Deprecations

Improvements

Bug fixes

cancensus 0.6.1

Bug fixes

Performance improvements

Minor changes

cancensus 0.6.0

Performance Improvements

Testing & Quality

New features

Various small improvements

cancensus 0.5.10

cancensus 0.5.8

cancensus 0.5.7

cancensus 0.5.6

cancensus 0.5.5

cancensus 0.5.4

cancensus 0.5.3

cancensus 0.5.2

cancensus 0.5.1

Minor changes

cancensus 0.5.0

Minor changes

cancensus 0.4.3

Minor changes

cancensus 0.4.2

Minor changes

cancensus 0.4.1

Minor changes

cancensus 0.4.0

Major changes

Minor changes

cancensus 0.3.2

Major changes

Minor changes

cancensus 0.3.1

Minor changes

cancensus 0.3.0

Major changes

Minor changes

cancensus 0.2.2

Minor changes

cancensus 0.2.1

Minor changes

cancensus 0.2.0

Major changes

Minor changes

cancensus 0.1.8

Major changes

Minor Changes

Bug fixes

cancensus 0.1.7

Major changes

cancensus 0.1.6

Major changes

Minor changes

Bug fixes

cancensus 0.1.5

Major changes

Minor changes

cancensus 0.1.0

Major changes

Minor changes

cancensus 0.0.1

Major changes