R/spat.folds.R

Defines functions spat.folds

Documented in spat.folds

spat.folds <- function(coords, nfolds = 10, size = 1000) {
  data_sf <- sf::st_as_sf(as.data.frame(coords[, 2:1]), coords = c("longitude", "latitude"), crs = 4326)
  cv_blocks <- blockCV::cv_spatial( x = data_sf, k = nfolds, size = size, hexagon = FALSE, report = FALSE,
                                    selection = "random", iteration = 100, progress = FALSE, plot = FALSE )$folds_list
}

Try the CompositionalSR package in your browser

Any scripts or data that you put into this service are public.

CompositionalSR documentation built on March 28, 2026, 5:07 p.m.