prepare_data | R Documentation |
Function to extract values from high-resolution covariates and join to low-resolution polygon data This function is mostly taken from the disaggregation package
prepare_data(
polygon_shapefile,
covariate_rasters,
aggregation_raster = NULL,
id_var = "area_id",
response_var = "response",
sample_size_var = NULL,
na.action = FALSE
)
polygon_shapefile |
sf object containing at least three columns: one with the geometried, one with the id for the polygons (id_var) and one with the response data (response_var); for binomial data, i.e survey data, it can also contain a sample size column (sample_size_var). |
covariate_rasters |
SpatRaster of covariate rasters to be used in the model. |
aggregation_raster |
SpatRaster to aggregate pixel level predictions to polygon level e.g. population to aggregate prevalence. If this is not supplied a uniform raster will be used. |
id_var |
Name of column in sf object with the polygon id. |
response_var |
Name of column in sf object with the response data. |
sample_size_var |
For survey data, name of column in sf object (if it exists) with the sample size data. |
na.action |
logical. If TRUE, NAs in response will be removed, covariate NAs will be given the median value, aggregation NAs will be set to zero. Default FALSE (NAs in response or covariate data within the polygons will give errors). |
Returns a dataframe containing the values of covariates for each pixel with the associated polygon ID
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.