train_test: Train-Test Partition

View source: R/trans_sample.R

train_testR Documentation

Train-Test Partition

Description

Partitions a dataset into training and test sets using a specified sampling method

Usage

train_test(obj, data, perc = 0.8, ...)

Arguments

obj

an object of a class that supports the train_test method

data

dataset to be partitioned

perc

a numeric value between 0 and 1 specifying the proportion of data to be used for training

...

additional optional arguments passed to specific methods.

Value

returns an list with two elements:

  • train: A data frame containing the training set

  • test: A data frame containing the test set

Examples

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

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

daltoolbox documentation built on Nov. 3, 2024, 9:06 a.m.