population_count {mapme.biodiversity} | R Documentation |
Calculate population count statistics
Description
WorldPop, which was initiated in 2013, offers easy access to spatial demographic datasets, claiming to use peer-reviewed and fully transparent methods to create global mosaics for the years 2000 to 2020. This function allows to efficiently calculate population count statistics (e.g. total number of population) for polygons. For each polygon, the desired statistic/s (min, max, sum, mean, median, sd or var) is/are returned.
Usage
calc_population_count(engine = "extract", stats = "sum")
Arguments
engine |
The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character. |
stats |
Function to be applied to compute statistics for polygons either one or multiple inputs as character "min", "max", "sum", "mean", "median" "sd" or "var". |
Details
The required resources for this indicator are:
Value
A function that returns an indicator tibble with the specified populations statistics as variable and the corresponding values as value.
Examples
## Not run:
library(sf)
library(mapme.biodiversity)
outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)
mapme_options(
outdir = outdir,
verbose = FALSE
)
aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
package = "mapme.biodiversity"
) %>%
read_sf() %>%
get_resources(get_worldpop(years = 2010:2020)) %>%
calc_indicators(
calc_population_count(engine = "extract", stats = c("sum", "median"))
) %>%
portfolio_long()
aoi
## End(Not run)