sample_random: Sample Random

View source: R/trans_sample_random.R

sample_randomR Documentation

Sample Random

Description

The sample_random function in R is used to generate a random sample of specified size from a given data set.

Usage

sample_random()

Value

returns an object of class 'sample_random

Examples

#using random sampling
sample <- sample_random()
tt <- train_test(sample, iris)

# distribution of train
table(tt$train$Species)

# 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 Nov. 3, 2024, 9:06 a.m.