dat <- readRDS(system.file("extdata","Cookfarm.RDS",package="CAST"))
dat <- dat[sample(1:nrow(dat),500),]
indices <- CreateSpacetimeFolds(dat,"SOURCEID","Date")
ctrl <- caret::trainControl(method="cv",index = indices$index,savePredictions="final")
model <- caret::train(dat[,c("DEM","TWI","BLD")],dat$VW, method="rf", trControl=ctrl, ntree=10)
global_validation(model)
Run the code above in your browser using DataLab