This function prepares tabular population exposure data compatible with the attribute() and compare() functions,
based on gridded pollution concentration data and polygon data representing geographic units.
If population data is provided, the function calculates an average concentration value in each geographic unit
that is weighted with the population number at each location.
If no population data is provided, the function calculates the simple spatial average concentration in each geographic unit.
Usage
prepare_exposure(
poll_grid,
geo_units,
population = NULL,
pop_grid = NULL,
geo_id_micro = NULL,
geo_id_macro = NULL,
bin_width = 0.1
)Arguments
- poll_grid
SpatRasterof the pollution concentration data.- geo_units
sfof the geographic units or sub-units.- population
Integer vectorof the total population number in each geographic sub-unit.- pop_grid
SpatRasterof the gridded population data.- geo_id_micro
Numeric or string vectorof the IDs of the geographic units. Required ifpop_gridis given or if no population data is provided.- geo_id_macro
Numeric or string vectorof the higher-level IDs of the geographic units the sub-unit belong to and will be aggregated at. Required ifpopulationis provided.- bin_width
Numericspecifying the width of the population exposure bins.
Value
This function returns a list containing:
1) main (list) containing the main results as vectors;
geo_id_microofgeo_id_macro(stringcolumn) containing the (higher-level) geographic IDs of the assessmentexposure_mean(numericcolumn) containing the (population-weighted) mean exposurepopulation_total(integercolumn) containing the total population in each geographic unit, if population data was provided
2) detailed (list) containing detailed (and interim) results.
Examples
# Goal: determine population-weighted mean PM2.5 exposure for several
# neighborhoods of Brussels (Belgium)
path <- system.file("extdata", "exdat_pwm_1.tif", package = "healthiar")
exdat_pwm_1 <- terra::rast(path)
pwm <- prepare_exposure(
poll_grid = exdat_pwm_1, # Formal class SpatRaster
geo_units = exdat_pwm_2, # sf of the geographic sub-units
population = sf::st_drop_geometry(exdat_pwm_2$population), # population per geographic sub-unit
geo_id_macro = sf::st_drop_geometry(exdat_pwm_2$region) # higher-level IDs to aggregate at
)
pwm$exposure_main # population-weighted mean exposures for the (higher-level) geographic units
#> $geo_id_macro
#> [1] "Center" "East" "North" "South" "West"
#>
#> $exposure_mean
#> [1] 11.47271 11.10716 11.48670 11.09940 11.38849
#>
#> $population_total
#> [1] 203105 187907 257573 308860 298802
#>
