Skip to contents

Query the CensusMapper API for available vectors for a given dataset.

Usage

list_census_vectors(
  dataset,
  use_cache = TRUE,
  quiet = TRUE,
  language = getOption("cancensus.language", "en")
)

Arguments

dataset

The dataset to query for available vectors, 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 FALSE, shows messages and warnings. Set to TRUE by default.

language

Language of the label and details columns, one of "en" or "fr". Defaults to the cancensus.language option, and to "en" if that is not set. Not all datasets have French labels. Vectors without French labels fall back to English, with a warning once per session and dataset that is shown independently of quiet. The type, units and aggregation columns are always in English.

Value

Returns a data frame detailing the available Census vectors (i.e. variables) for a given Census dataset. This data frame has columns vector containing the short code for the variable, type describing whether it's a female, male, or total aggregate, label indicating the name of the variable, units indicating whether the value represents a numeric integer, percentage, dollar figure, or ratio, parent_vector to show hierarchical relationship, aggregation indicating whether the value is additive or a transformation, and a column details with a detailed description of the variable generated by traversing all labels within its hierarchical structure.

Examples


if (FALSE) { # \dontrun{
# List all vectors for a given Census dataset in CensusMapper
list_census_vectors('CA16')

# The same list with French labels
list_census_vectors('CA16', language = 'fr')
} # }