train_test {daltoolbox} | R 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 |
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)
[Package daltoolbox version 1.2.707 Index]