| z22_data | R Documentation |
Retrieve the values and coordinates of gridded features from the censuses 2011 and 2022.
When we are talking about a
feature, we talk about an indicator aggregated to grid cells, e.g., age or the number of dwellings.
category, we talk about the discrete classifications of features, e.g., ages 10 to 19, 20 to 20, 30 to 39, etc.
Both feature and category have to be provided to uniquely identify a dataset.
z22_data(
feature,
categories = NULL,
year = 2022,
res = "1km",
all_cells = FALSE,
normalize = FALSE,
as = c("df", "sf", "raster"),
update_cache = FALSE
)
feature |
A grid feature. See |
categories |
One or multiple feature categories. See
|
year |
Census year. Currently, only 2011 and 2022 are available. Defaults to 2022. |
res |
Resolution of the grid dataset. Can be |
all_cells |
If |
normalize |
If |
as |
Specifies the output class. Must be one of |
update_cache |
By default, both functions cache attribute files for
the remainder of the R session. They are downloaded to a temporary directory
and - if the file to download already exists - are recovered from the cache.
In other words, when rerunning the same request multiple times, the
subsequent calls should be much faster. If |
By default, data are downloaded from the
z22data data repository which
stores all pre-processed data. You can download this repository and use
it offline or use an entirely different repository by setting
options(z22.data_repo = "path/to/z22data").
A tibble, SpatRaster or
sf tibble depending on the as argument.
If a tibble is returned each category in categories is stored in
a column. If a SpatRaster is returned, each category is a
named layer.
# Get gridded population
pop <- z22_data("population", res = "10km", as = "raster")
terra::plot(pop$cat_0)
# Get data about the number of people born in a EU27 country
z22_data("birth_country", categories = 21, res = "1km")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.