The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

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>.

Version: 4.0-0
Depends: R (≥ 3.6.0)
Imports: sf (≥ 1.0), terra (≥ 1.6-41), ggplot2 (≥ 3.3.6), cowplot, automap (≥ 1.1-20), Rcpp (≥ 1.0.2)
LinkingTo: Rcpp
Suggests: shiny (≥ 1.7), tmap (≥ 2.0), biomod2, gstat, methods, knitr, rmarkdown, testthat (≥ 3.0.0)
Published: 2026-08-20
DOI: 10.32614/CRAN.package.blockCV
Author: Roozbeh Valavi ORCID iD [aut, cre], Jane Elith [aut], José Lahoz-Monfort [aut], Ian Flint [aut], Gurutzeta Guillera-Arroita [aut]
Maintainer: Roozbeh Valavi <valavi.r at gmail.com>
BugReports: https://github.com/rvalavi/blockCV/issues
License: GPL (≥ 3)
URL: https://github.com/rvalavi/blockCV
NeedsCompilation: yes
Citation: blockCV citation info
Materials: README, NEWS
In views: Spatial
CRAN checks: blockCV results

Documentation:

Reference manual: blockCV.html , blockCV.pdf
Vignettes: 1. blockCV introduction: how to create block cross-validation folds (source, R code)
2. Choosing and diagnosing spatial folds (source, R code)
3. Block cross-validation for species distribution modelling (source, R code)
4. Using blockCV with caret (source, R code)

Downloads:

Package source: blockCV_4.0-0.tar.gz
Windows binaries: r-devel: blockCV_4.0-0.zip, r-release: blockCV_4.0-0.zip, r-oldrel: blockCV_4.0-0.zip
macOS binaries: r-release (arm64): blockCV_4.0-0.tgz, r-oldrel (arm64): blockCV_4.0-0.tgz, r-release (x86_64): blockCV_4.0-0.tgz, r-oldrel (x86_64): blockCV_4.0-0.tgz
Old sources: blockCV archive

Reverse dependencies:

Reverse imports: CompositionalSR, glossa, intSDM, PointedSDMs
Reverse suggests: BiodiversityR, caretSDM, confcons, ENMeval, forestecology, mlr3spatiotempcv, spboost, tidysdm

Linking:

Please use the canonical form https://CRAN.R-project.org/package=blockCV to link to this page.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.