Creates spatial block CV folds that plug directly into
tune::tune_grid() and tune::fit_resamples().
Arguments
- data
A data frame,
sfobject, orterra::SpatVector.- coords
Character vector of length 2. Coordinate column names.
- target
Character. Target variable for autocorrelation diagnosis.
- v
Integer. Number of folds. Default: 5.
- buffer
Numeric. Optional spatial buffer distance for exclusion.
- repeats
Integer. Number of repeated fold sets. Default: 1.
- ...
Additional arguments passed to
borg_cv().
Examples
# \donttest{
if (requireNamespace("rsample", quietly = TRUE)) {
set.seed(42)
d <- data.frame(x = runif(100), y = runif(100), z = rnorm(100))
folds <- borg_spatial_cv(d, coords = c("x", "y"), target = "z")
}
# }