k_fold {daltoolbox} | R Documentation |
k-fold sampling
Description
k-fold partition of a dataset using a sampling method
Usage
k_fold(obj, data, k)
Arguments
obj |
object |
data |
dataset |
k |
number of folds |
Value
k folds
Examples
#using random sampling
sample <- sample_random()
# preparing dataset into four folds
folds <- k_fold(sample, iris, 4)
# distribution of folds
tbl <- NULL
for (f in folds) {
tbl <- rbind(tbl, table(f$Species))
}
head(tbl)
[Package daltoolbox version 1.0.767 Index]