if (FALSE) {
data(cookfarm)
### Prepare for 10-fold Leave-Location-and-Time-Out cross validation
indices <- CreateSpacetimeFolds(cookfarm,"SOURCEID","Date")
str(indices)
### Prepare for 10-fold Leave-Location-Out cross validation
indices <- CreateSpacetimeFolds(cookfarm,spacevar="SOURCEID")
str(indices)
### Prepare for leave-One-Location-Out cross validation
indices <- CreateSpacetimeFolds(cookfarm,spacevar="SOURCEID",
k=length(unique(cookfarm$SOURCEID)))
str(indices)
### example from splotopen and visualization
data(splotdata)
indices <- CreateSpacetimeFolds(splotdata,spacevar="Country")
ggplot() +
geom_sf(data = splotdata, aes(col = factor(indices$cluster)))
## is this representative?
data(splotdata)
studyArea <- rnaturalearth::ne_countries(continent = "South America", returnclass = "sf")
dist <- geodist(splotdata, studyArea,cvfolds=indices$cluster)
plot(dist)+ scale_x_log10(labels=round)
}
Run the code above in your browser using DataLab