Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

splitdata

Splits a dataset into training set and test set


Description

This function splits a dataset into training set and test set. Return an object of class dataset-class.

Usage

splitdata(dataset, target, size = round(0.7 * nrow(dataset)), seed = NULL)

Arguments

dataset

The dataset to be split (data.frame or matrix).

target

The column index of the target variable (class label or response variable).

size

The size of the training set (as an integer value).

seed

A specified seed for random number generation.

Value

An object of class dataset-class.

See Also

Examples

require (datasets)
data (iris)
d = splitdata (iris, 5)
str (d)

fdm2id

Data Mining and R Programming for Beginners

v0.9.5
GPL-3
Authors
Alexandre Blansché [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.