train_test | R Documentation |
Partitions a dataset into training and test sets using a specified sampling method
train_test(obj, data, perc = 0.8, ...)
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. |
returns an list with two elements:
train: A data frame containing the training set
test: A data frame containing the test set
#using random sampling
sample <- sample_random()
tt <- train_test(sample, iris)
# distribution of train
table(tt$train$Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.