cvfolds | R Documentation |
Randomly split the data indexes into nfolds
folds.
cvfolds(nfolds, datasize)
nfolds |
The number of folds used in cross-validation. |
datasize |
The sample size. |
A list
. Each element contains the index vector of sample data included in this fold.
# Given sample size 20, generate 5 folds
set.seed(1212)
cvfolds(5, 20)
#[[1]]
# [1] 6 11 14 16
#[[2]]
# [1] 3 5 10 18
#[[3]]
# [1] 4 7 8 19
#[[4]]
# [1] 2 9 12 15
#[[5]]
# [1] 1 13 17 20
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.