Extract Raster Values at Location of Sites
Value
A data.frame
with average environmental values (columns) per site
(rows), with the first column being "site"
indicating site names.
Examples
library("funbiogeo")
data("site_locations")
## Import climate rasters ----
prec <- system.file("extdata", "annual_tot_prec.tif", package = "funbiogeo")
tavg <- system.file("extdata", "annual_mean_temp.tif", package = "funbiogeo")
layers <- terra::rast(c(tavg, prec))
fb_get_environment(head(site_locations), layers)
#> site annual_mean_temp annual_tot_prec
#> 1 1 6.6755822 2480.2222
#> 2 2 1.6836227 1994.0000
#> 3 3 0.6628264 1384.5000
#> 4 4 1.4940648 1033.4444
#> 5 5 2.6325313 945.3611
#> 6 6 3.0806597 975.2778