cvfolds {cvmaPLFAM} | R Documentation |
Generate cross-validation folds
Description
Randomly split the data indexes into nfolds
folds.
Usage
cvfolds(nfolds, datasize)
Arguments
nfolds |
The number of folds used in cross-validation. |
datasize |
The sample size. |
Value
A list
. Each element contains the index vector of sample data included in this fold.
Examples
# 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
[Package cvmaPLFAM version 0.1.0 Index]