Runs Stage 1 (locate or download) and Stage 2 (parse metadata) and returns the full bilingual canonical metadata. Both `label_en` and `label_fr` columns are always returned regardless of language. This is useful for inspecting variable definitions and code labels before loading data with [get_pumf()].
Arguments
- series
Survey series acronym, e.g. `"SFS"`, `"LFS"`, `"Census"`.
- version
Version string, e.g. `"2019"`, `"2021 (individuals)"`.
- cache_path
Root cache directory. Defaults to `getOption("canpumf.cache_path", tempdir())`.
- refresh
If `TRUE`, re-parse metadata from the already-extracted raw command files (does not re-download).
- redownload
If `TRUE`, delete the cached zip and extracted files and re-download from StatCan before re-parsing. Implies `refresh = TRUE`.
- registry
Optional custom configuration created by [pumf_registry_entry()] (or [pumf_registry()]) to drive metadata parsing for a survey not in the built-in registry, or to override fields of one that is. Not supported for LFS.
Value
A named list with three elements:
- `variables`
Tibble with columns `name`, `label_en`, `label_fr`, `type`, `decimals`, `missing_low`, `missing_high`.
- `codes`
Tibble with columns `name`, `val`, `label_en`, `label_fr`, mapping numeric codes to their labels.
- `layout`
Tibble with columns `name`, `start`, `end` for fixed-width data files; `NULL` for CSV-format surveys.
Returns `invisible(NULL)` with an informative message if the data must be downloaded but Statistics Canada is unreachable.
Examples
# \donttest{
meta <- pumf_metadata("SFS", "2019")
if (!is.null(meta)) {
meta$variables
meta$codes[meta$codes$name == "PEFAMID", ]
}
#> # A tibble: 0 × 4
#> # ℹ 4 variables: name <chr>, val <chr>, label_en <chr>, label_fr <chr>
# }
