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 |
an object representing the sampling method |
data |
dataset to be partitioned |
k |
number of folds |
Value
returns a list of k
data frames
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.2.707 Index]