load_worldpop_age: Function to get population data from a worldpop geotiff and...

View source: R/worldpop_data.R

load_worldpop_ageR Documentation

Function to get population data from a worldpop geotiff and geounit shapefile This function extracts raster values for overlayed polygons

Description

Function to get population data from a worldpop geotiff and geounit shapefile This function extracts raster values for overlayed polygons

Usage

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"
)

Arguments

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

Value

long age population data by admin level 2

References

WorldPop (https://www.worldpop.org/geodata)


HopkinsIDD/globaltoolboxlite documentation built on Jan. 12, 2024, 5:49 a.m.