CAST
'caret' Applications for Spatial-Temporal Models
Description
Supporting functionality to run 'caret' with spatial or spatial-temporal data. 'caret' is a frequently used package for model training and prediction using machine learning. CAST includes functions to improve spatial or spatial-temporal modelling tasks using 'caret'. It includes the newly suggested 'Nearest neighbor distance matching' cross-validation to estimate the performance of spatial prediction models and allows for spatial variable selection to selects suitable predictor variables in view to their contribution to the spatial model performance. CAST further includes functionality to estimate the (spatial) area of applicability of prediction models. Methods are described in Meyer et al. (2018) <doi:10.1016/j.envsoft.2017.12.001>; Meyer et al. (2019) <doi:10.1016/j.ecolmodel.2019.108815>; Meyer and Pebesma (2021) <doi:10.1111/2041-210X.13650>; MilĂ et al. (2022) <doi:10.1111/2041-210X.13851>; Meyer and Pebesma (2022) <doi:10.1038/s41467-022-29838-9>; Linnenbrink et al. (2024) <doi:10.5194/gmd-17-5897-2024>; Schumacher et al. (2025) <doi:10.5194/gmd-18-10185-2025>. The package is described in detail in Meyer et al. (2026) <doi:10.1007/978-3-031-99665-8_11>.
Downloads
3.2K
Last 30 days
2291st
10.1K
Last 90 days
31.9K
Last year
Trend: -6.7% (30d vs prior 30d)
CRAN Check Status
Show all 14 flavors
| Flavor | Status |
|---|---|
| r-devel-linux-x86_64-debian-clang | OK |
| r-devel-linux-x86_64-debian-gcc | OK |
| r-devel-linux-x86_64-fedora-clang | OK |
| r-devel-linux-x86_64-fedora-gcc | OK |
| r-devel-macos-arm64 | OK |
| r-devel-windows-x86_64 | ERROR |
| r-oldrel-macos-arm64 | OK |
| r-oldrel-macos-x86_64 | OK |
| r-oldrel-windows-x86_64 | OK |
| r-patched-linux-x86_64 | OK |
| r-release-linux-x86_64 | OK |
| r-release-macos-arm64 | OK |
| r-release-macos-x86_64 | OK |
| r-release-windows-x86_64 | OK |
Check details (1 non-OK)
tests
Running 'testthat.R' [119s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(CAST)
>
> test_check("CAST")
Loading required package: ggplot2
Loading required package: lattice
note: variables were not weighted either because no weights or model were given,
no variable importance could be retrieved from the given model, or the model has a single feature.
Check caret::varImp(model)
note: No model and no CV folds were given. The DI threshold is therefore based on all training data
note: variables were not weighted either because no weights or model were given,
no variable importance could be retrieved from the given model, or the model has a single feature.
Check caret::varImp(model)
note: No model and no CV folds were given. The DI threshold is therefore based on all training data
[1] "model using Sepal.Length,Sepal.Width will be trained now..."
note: only 1 unique complexity parameters in defaul
...[truncated]...
planar
although coordinates are longitude/latitude, st_sample assumes that they are
planar
1000 prediction points are sampled from the modeldomain
Gij <= Gj; a random CV assignment is returned
1000 prediction points are sampled from the modeldomain
Gij <= Gj; a random CV assignment is returned
1000 prediction points are sampled from the modeldomain
predictor values are extracted for prediction points
Gij <= Gj; a random CV assignment is returned
1000 prediction points are sampled from the modeldomain
predictor values are extracted for prediction points
Gij <= Gj; a random CV assignment is returned
1000 prediction points are sampled from the modeldomain
although coordinates are longitude/latitude, st_sample assumes that they are
planar
predictor values are extracted for prediction points
variable(s) 'fct' is (are) treated as categorical variables
some prediction points contain NAs, which will be removed
Gij <= Gj; a random CV assignment is returned
Check History
ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 31, 2026
tests
Running 'testthat.R' [120s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(CAST)
>
> test_check("CAST")
Loading required package: ggplot2
Loading required package: lattice
note: variables
...[truncated]...
es that they are
planar
predictor values are extracted for prediction points
variable(s) 'fct' is (are) treated as categorical variables
some prediction points contain NAs, which will be removed
Gij <= Gj; a random CV assignment is returned
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 30, 2026
ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 18, 2026
tests
Running 'testthat.R' [118s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(CAST)
>
> test_check("CAST")
Loading required package: ggplot2
Loading required package: lattice
note: variables
...[truncated]...
es that they are
planar
predictor values are extracted for prediction points
variable(s) 'fct' is (are) treated as categorical variables
some prediction points contain NAs, which will be removed
Gij <= Gj; a random CV assignment is returned
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 16, 2026
ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 11, 2026
re-building of vignette outputs
Error(s) in re-building vignettes: --- re-building 'cast01-CAST-intro.Rmd' using rmarkdown Quitting from cast01-CAST-intro.Rmd:72-78 [unnamed-chunk-5] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <error/rlang_erro ...[truncated]... re-building 'cast05-parallel.Rmd' using rmarkdown --- finished re-building 'cast05-parallel.Rmd' SUMMARY: processing the following files failed: 'cast01-CAST-intro.Rmd' 'cast02-plotgeodist.Rmd' Error: Vignette re-building failed. Execution halted