powered by
This function splits a dataset into training set and test set. Return an object of class dataset-class.
dataset-class
splitdata(dataset, target, size = round(0.7 * nrow(dataset)), seed = NULL)
An object of class dataset-class.
The dataset to be split (data.frame or matrix).
data.frame
matrix
The column index of the target variable (class label or response variable).
The size of the training set (as an integer value).
A specified seed for random number generation.
require (datasets) data (iris) d = splitdata (iris, 5) str (d)
Run the code above in your browser using DataLab