if (FALSE) {
dat <- readRDS(system.file("extdata","Cookfarm.RDS",package="CAST"))
### Prepare for 10-fold Leave-Location-and-Time-Out cross validation
indices <- CreateSpacetimeFolds(dat,"SOURCEID","Date")
str(indices)
### Prepare for 10-fold Leave-Location-Out cross validation
indices <- CreateSpacetimeFolds(dat,spacevar="SOURCEID")
str(indices)
### Prepare for leave-One-Location-Out cross validation
indices <- CreateSpacetimeFolds(dat,spacevar="SOURCEID",
k=length(unique(dat$SOURCEID)))
str(indices)
}
Run the code above in your browser using DataLab