View source: R/extract_covars.R
extract_covars | R Documentation |
Extract covariate values from a set of rasters
extract_covars(locations, raster_list)
locations |
a data frame of (x,y) locations with names "x" and "y". |
raster_list |
a list of raster objects. |
a matrix of covariates drawn from the provided rasters.
# Load example raster data
raster_paths <- list.files(system.file("extdata", package = "ldmppr"),
pattern = "\\.tif$", full.names = TRUE
)
rasters <- lapply(raster_paths, terra::rast)
# Scale the rasters
scaled_raster_list <- scale_rasters(rasters)
# Load example locations
locations <- small_example_data %>%
dplyr::select(x, y) %>%
as.matrix()
# Extract covariates
example_covars <- extract_covars(locations, scaled_raster_list)
head(example_covars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.