k_fold: k-fold sampling

View source: R/trans_sample.R

k_foldR 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)

daltoolbox documentation built on May 29, 2024, 1:57 a.m.