View source: R/worldpop_data.R
load_worldpop_age | R Documentation |
Function to get population data from a worldpop geotiff and geounit shapefile This function extracts raster values for overlayed polygons
load_worldpop_age(
shp,
country = "BGD",
year = "2020",
save_dir = "raw_data",
cores = 4,
loc_var = "NAME_2",
shp_vars = c("GID_0", "NAME_0", "GID_1", "NAME_1", "GID_2", "NAME_2"),
add_pop_to_shapefile = TRUE,
shp_country_var = "GID_0"
)
shp |
Shapefile file path for shapefile of geounits (i.e., admin2) |
country |
ISO3 of country of interest |
year |
Year of population data (2000 to 2020) |
save_dir |
directory where to save geotiff files |
cores |
number of cores to parallelize over |
loc_var |
name of location name or id variable, if want to reduce data to this and population data |
add_pop_to_shapefile |
logical, whether to add total population to the shapefile |
shp_country_var |
Variable in the shapefile denoting the country ISO3 code. For GADM shapefiles, this is GID_0. If NULL, no subsetting done |
long age population data by admin level 2
WorldPop (https://www.worldpop.org/geodata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.