CreateSpacetimeFolds-deprecated: Create Space-time Folds

CreateSpacetimeFolds-deprecatedR Documentation

Create Space-time Folds

Description

Create spatial, temporal or spatio-temporal Folds for cross validation

Usage

CreateSpacetimeFolds(x, spacevar = NA, timevar = NA, k = 10
, seed = sample(1:1000, 1))

Arguments

x

data.frame containing spatio-temporal data

spacevar

Character indicating which column of x identifies the spatial units (e.g. ID of weather stations)

timevar

Character indicating which column of x identifies the temporal units (e.g. the day of the year)

k

numeric. Number of folds. If spacevar or timevar is NA and a leave one location out or leave one time step out cv should be performed, set k to the number of unique spatial or temporal units.

seed

See set.seed.

Value

A list that contains a list for model training and a list for model validation that can directly be used as "index" and "indexOut" in caret's train function

Author(s)

Hanna Meyer

See Also

Rsenal-deprecated

Examples

 ## Not run: 
library(GSIF)
data(cookfarm)
indices <- CreateSpacetimeFolds(cookfarm$readings,"SOURCEID","Date")
str(indices)
### Prepare for leave one location out cross validation
indices <- CreateSpacetimeFolds(cookfarm$readings,spacevar="SOURCEID",
k=length(unique(cookfarm$readings$SOURCEID)))

## End(Not run)

environmentalinformatics-marburg/Rsenal documentation built on July 28, 2023, 6:09 a.m.