# \donttest{
library(blockCV)
# import presence-absence species data
points <- read.csv(system.file("extdata/", "species.csv", package = "blockCV"))
# make an sf object from data.frame
pa_data <- sf::st_as_sf(points, coords = c("x", "y"), crs = 7845)
# load raster data
path <- system.file("extdata/au/", package = "blockCV")
files <- list.files(path, full.names = TRUE)
covars <- terra::rast(files)
# hexagonal spatial blocking by specified size and random assignment
sb <- cv_spatial(x = pa_data,
column = "occ",
size = 450000,
k = 5,
iteration = 1)
# compute extrapolation
cv_similarity(cv = sb, r = covars, x = pa_data)
# }
Run the code above in your browser using DataLab