Learn R Programming

sail (version 0.1.0)

createfolds: Create CV Folds

Description

createfolds splits the data into k groups. Taken from the caret package (see references for details)

Usage

createfolds(y, k = 10, list = FALSE, returnTrain = FALSE)

Arguments

y

vector of response

k

integer for the number of folds.

list

logical - should the results be in a list (TRUE) or a matrix

returnTrain

a logical. When true, the values returned are the sample positions corresponding to the data used during training. This argument only works in conjunction with list = TRUE

Value

A vector of CV fold ID's for each observation in y

Details

For numeric y, the sample is split into groups sections based on percentiles and sampling is done within these subgroups

References

https://topepo.github.io/caret/data-splitting.html