View source: R/make.spatial.folds.R
make.spatial.folds | R Documentation |
This function takes in a data frame containing coordinates and creates a spatially blocked set of k folds.
make.spatial.folds(data, rangeX, rangeY, k = 5, coord.names = c("x", "y"))
data |
a data frame with columns |
rangeX |
a vector of length 2 denoting the range of the horizontal coordinate. If missing this will be obtained from |
rangeY |
a vector of length 2 denoting the range of the vertical coordinate. If missing this will be obtained from |
k |
an integer denoting the number of folds. Default is 5. |
coord.names |
a vector of length two describing the column names of the horizontal and vertical coordinates in |
a vector of length nrow(data)
with integers denoting the fold into which each point falls.
#' # Get the gorilla nesting data
dat <- gorillas
# create spatial CV folds
dat$fold <- make.spatial.folds(dat)
# view the folds
table(dat$fold)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.