Package: blockCV 4.0-2

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

Authors:Roozbeh Valavi [aut, cre], Jane Elith [aut], José Lahoz-Monfort [aut], Ian Flint [aut], Gurutzeta Guillera-Arroita [aut]

blockCV_4.0-2.tar.gz
blockCV_4.0-2.zip(r-4.7-x86_64)blockCV_4.0-2.zip(r-4.7-arm64)blockCV_4.0-2.zip(r-4.6-x86_64)blockCV_4.0-2.zip(r-4.6-arm64)blockCV_4.0-2.zip(r-4.5-x86_64)
blockCV_4.0-2.tgz(r-4.6-x86_64)blockCV_4.0-2.tgz(r-4.6-arm64)blockCV_4.0-2.tgz(r-4.5-x86_64)blockCV_4.0-2.tgz(r-4.5-arm64)
blockCV_4.0-2.tar.gz(r-4.7-arm64)blockCV_4.0-2.tar.gz(r-4.7-x86_64)blockCV_4.0-2.tar.gz(r-4.6-arm64)blockCV_4.0-2.tar.gz(r-4.6-x86_64)
blockCV_4.0-2.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
blockCV/json (API)

# Install 'blockCV' in R:
install.packages('blockCV', repos = c('https://rvalavi.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/rvalavi/blockcv/issues

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cross-validationspatialspatial-cross-validationspatial-modellingspecies-distribution-modellingcpp

11.64 score 147 stars 4 packages 581 scripts 4.2k downloads 5 mentions 12 exports 44 dependencies

Last updated from:51e6903fe6. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK206
linux-devel-x86_64OK235
source / vignettesOK320
linux-release-arm64OK198
linux-release-x86_64OK704
macos-release-arm64OK219
macos-release-x86_64OK274
macos-oldrel-arm64OK156
macos-oldrel-x86_64OK245
windows-devel-arm64OK327
windows-devel-x86_64OK173
windows-release-arm64OK328
windows-release-x86_64OK193
windows-oldrel-x86_64OK180
wasm-releaseOK156

Exports:cv_block_sizecv_buffercv_clustercv_distancecv_groupcv_knndmcv_nndmcv_plotcv_similaritycv_spatialcv_spatial_autocorcv_summary

Dependencies:abindautomapclassclassIntclicowplotcpp11DBIe1071farverFNNggplot2gluegstatgtableintervalsisobandKernSmoothlabelinglatticelifecycleplyrproxyR6RColorBrewerRcppreshaperlangs2S7scalessfsftimespspacetimestarsterraunitsvctrsviridisLitewithrwkxtszoo

Block cross-validation for species distribution modelling
Introduction | Reading and plotting data | Generating block CV folds | Evaluating SDMs with block cross-validation: examples | Using blockCV with Random Forest model | Using blockCV in biomod2 package | References:

Last update: 2026-10-13
Started: 2026-07-09

blockCV introduction: how to create block cross-validation folds
Introduction | Installation | Package data | Block cross-validation strategies | Spatial blocks | Spatial and environmental clustering | Leave-group-out cross-validation | Buffering LOO (also known as Spatial LOO) | Nearest Neighbour Distance Matching (NNDM) LOO | k-fold Nearest Neighbour Distance Matching (kNNDM) | Visualising the folds | Next steps | References:

Last update: 2026-07-10
Started: 2023-01-29

Choosing and diagnosing spatial folds
Introduction | Prepare data and folds | Fold-quality summary | Environmental similarity diagnostics | Nearest-neighbour distance diagnostics | Choosing a candidate block size | References:

Last update: 2026-07-09
Started: 2023-01-29

Using blockCV with caret
Introduction | Prepare the data | Create spatial folds | Fit a caret model | References

Last update: 2026-07-09
Started: 2026-07-09