blockCV: Spatial and Environmental Blocking for Cross-Validation

Creates spatially or environmentally separated, or group-preserving, training and testing folds for k-fold, leave-group-out, and leave-one-out cross-validation. Provides spatial blocking, clustering, buffering, and nearest-neighbour distance-matching methods, together with tools to visualise folds, summarise fold sizes and class balance, and assess train–test separation and environmental novelty. Also estimates spatial autocorrelation ranges in point samples and continuous raster covariates to provide an initial distance scale for designing spatial folds. Methods are described in Valavi, R. et al. (2019) <doi:10.1111/2041-210X.13107>.

Package details

AuthorRoozbeh Valavi [aut, cre] (ORCID: <https://orcid.org/0000-0003-2495-5277>), Jane Elith [aut], José Lahoz-Monfort [aut], Ian Flint [aut], Gurutzeta Guillera-Arroita [aut]
MaintainerRoozbeh Valavi <valavi.r@gmail.com>
LicenseGPL (>= 3)
Version4.0-0
URL https://github.com/rvalavi/blockCV
Package repositoryView on CRAN
Installation Install the latest version of this package by entering the following in R:
install.packages("blockCV")

Try the blockCV package in your browser

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

blockCV documentation built on Aug. 20, 2026, 5:10 p.m.