Skip to content

CAST

'caret' Applications for Spatial-Temporal Models

v1.0.4 · Jan 26, 2026 · GPL (>= 2)

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

1 ERROR
13 OK
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)
ERROR r-devel-windows-x86_64

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
ERROR r-devel-windows-x86_64

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
ERROR r-devel-windows-x86_64

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
ERROR r-oldrel-windows-x86_64

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
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Reverse Dependencies (4)

imports

Dependency Network

Dependencies Reverse dependencies caret ggplot2 FNN plyr zoo data.table sf forcats twosamples terra sp climodr meteo mlr3spatiotempcv waywiser CAST

Version History

new 1.0.4 Mar 10, 2026
updated 1.0.4 ← 1.0.3 diff Jan 25, 2026
updated 1.0.3 ← 1.0.2 diff Jan 9, 2025
updated 1.0.2 ← 1.0.1 diff Jun 14, 2024
updated 1.0.1 ← 1.0.0 diff Apr 24, 2024
updated 1.0.0 ← 0.9.0 diff Apr 7, 2024
updated 0.9.0 ← 0.8.1 diff Jan 8, 2024
updated 0.8.1 ← 0.8.0 diff May 29, 2023
updated 0.8.0 ← 0.7.1 diff May 20, 2023
updated 0.7.1 ← 0.7.0 diff Feb 3, 2023
updated 0.7.0 ← 0.6.0 diff Aug 23, 2022
updated 0.6.0 ← 0.5.1 diff Mar 16, 2022
updated 0.5.1 ← 0.5.0 diff Apr 6, 2021
updated 0.5.0 ← 0.4.2 diff Feb 18, 2021
updated 0.4.2 ← 0.4.1 diff Jul 16, 2020
updated 0.4.1 ← 0.4.0 diff May 18, 2020
updated 0.4.0 ← 0.3.1 diff Apr 5, 2020
updated 0.3.1 ← 0.3.0 diff Nov 18, 2018
updated 0.3.0 ← 0.2.1 diff Oct 10, 2018
updated 0.2.1 ← 0.2.0 diff Jul 11, 2018