| getCovariate | R Documentation |
This function aligns raster covariates to a population density grid, extracts values for a national grid, associates administrative information, and prepares covariates for cluster-based data.
getCovariate(
tiffs,
tiff.population,
UR.surface = NULL,
cluster.info,
poly.adm,
by.adm,
by.adm.upper,
standardize = FALSE,
na.rm = FALSE,
fact = 1
)
tiffs |
A list of 'SpatRaster' with element names the column names for the covariates. |
tiff.population |
A 'SpatRaster' object representing population density used as the reference grid. |
UR.surface |
(Optional) A 'SpatRaster' object indicating urban-rural classification. |
cluster.info |
**Need STRATA here** |
poly.adm |
A 'sf' object |
by.adm |
the column name of column for Admin names for admin 1 |
by.adm.upper |
the column name of column for Admin names for admin 2 or other lower admin level. |
standardize |
whether to standardize the covariates/tiffs or not |
na.rm |
whether to remove rows that have no Population or admin 2 membership |
fact |
A numeric value indicating the aggregation factor for resampling the raster data. If 'fact = 1', no aggregation is performed. |
The function follows these steps: 1. Converts 'poly.adm' to an 'sf' object. 2. Aligns rasters in 'tiffs' to match the 'tiff.population' grid using bilinear resampling. 3. Aggregates raster resolution if 'fact' is greater than 1. 4. Extracts pixel center coordinates and values for the national grid. 5. Matches pixel locations to administrative boundaries. 6. Extracts raster values at cluster locations.
A list with two elements:
natl.grid |
A data frame containing natl grid of pixels for covariates and Admin information. |
cluster.cov |
A data frame with extracted covariates for cluster locations. U/R info from DHS |
## Not run:
kenya_cov <- getCovariate(
tiffs = cov_raster_stack,
tiff.population = avg.pop,
UR.surface = UR_surface,
cluster.info = cluster.info,
poly.adm = poly.adm2,
by.adm = 'NAME_2',
by.adm.upper = 'NAME_1',
standardize=FALSE,
. na.rm=FALSE,
fact = 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.