powered by
Partitions a dataset into training and test sets using a specified sampling method
train_test(obj, data, perc = 0.8, ...)
returns an list with two elements:
train: A data frame containing the training set
test: A data frame containing the test set
an object of a class that supports the train_test method
train_test
dataset to be partitioned
a numeric value between 0 and 1 specifying the proportion of data to be used for training
additional optional arguments passed to specific methods.
#using random sampling sample <- sample_random() tt <- train_test(sample, iris) # distribution of train table(tt$train$Species)
Run the code above in your browser using DataLab