| nor_population_by_age_cats | R Documentation |
Aggregates the bundled Norwegian population dataset (from Statistics Norway) into caller-defined age bands. The underlying data covers every integer age from 0 to 105 at national, county, municipality, and city-district level.
nor_population_by_age_cats(
cats = NULL,
include_total = TRUE,
include_9999 = FALSE,
border = csdata::config$border_nor
)
cats |
A named or unnamed list of integer vectors specifying the age
values to include in each category. Each vector element defines one age
band. If a list element is named, that name is used as the |
include_total |
Logical. If |
include_9999 |
Logical. If |
border |
Integer. The geographic border year. Valid values: |
A data.table with columns:
Geographic granularity level.
Location code.
Age category label, as derived from cats names or
auto-generated, plus "total" if include_total = TRUE.
Sex. Always "total" in the current dataset.
Calendar year.
Population count as of 1 January of calyear.
Logical. TRUE if the value was imputed.
## Not run:
# Not run: aggregates the full population dataset, which exceeds CRAN's
# example time limit.
# Default: return total population only
d <- nor_population_by_age_cats()
head(d[granularity_geo == "nation"])
# Named age bands
d2 <- nor_population_by_age_cats(
cats = list("children" = 0:17, "working_age" = 18:66, "elderly" = 67:105),
include_total = TRUE
)
d2[granularity_geo == "nation" & calyear == 2024]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.