Query the CensusMapper API for available regions in a given dataset.

list_census_regions(dataset, use_cache = TRUE, quiet = FALSE)

Arguments

dataset

The dataset to query for available regions, e.g. "CA16".

use_cache

If set to TRUE (the default), data will be read from a local cache that is maintained for the duration of the R session, if available. If set to FALSE, query the API for the data, and refresh the local cache with the result.

quiet

When TRUE, suppress messages and warnings.

Value

Returns a data frame with the following columns:

region

The region identifier.

name

The name of that region.

level

The census aggregation level of that region.

pop

The population of that region.

municipal_status

Additional identifiers to distinguish the municipal status of census subdivisions.

CMA_UID

The identifier for the Census Metropolitan Area the region is in (if any).

CD_UID

The identifier for the Census District the region is in (if any).

PR_UID

The identifier for the Province the region is in (if unique).

Examples

list_census_regions('CA16')
#> Querying CensusMapper API for regions data...
#> # A tibble: 5,518 × 8
#>    region name              level     pop municipal_status CMA_UID CD_UID PR_UID
#>    <chr>  <chr>             <chr>   <int> <chr>            <chr>   <chr>  <chr> 
#>  1 01     Canada            C      3.52e7 NA               NA      NA     NA    
#>  2 35     Ontario           PR     1.34e7 NA               NA      NA     NA    
#>  3 24     Quebec            PR     8.16e6 NA               NA      NA     NA    
#>  4 59     British Columbia  PR     4.65e6 NA               NA      NA     NA    
#>  5 48     Alberta           PR     4.07e6 NA               NA      NA     NA    
#>  6 46     Manitoba          PR     1.28e6 NA               NA      NA     NA    
#>  7 47     Saskatchewan      PR     1.10e6 NA               NA      NA     NA    
#>  8 12     Nova Scotia       PR     9.24e5 NA               NA      NA     NA    
#>  9 13     New Brunswick     PR     7.47e5 NA               NA      NA     NA    
#> 10 10     Newfoundland and… PR     5.20e5 NA               NA      NA     NA    
#> # … with 5,508 more rows