Learn R Programming

liver (version 1.19)

partition: Partition the data

Description

Randomly partitions the data (primarly intended to split into "training" and "test" sets) according to the supplied probabilities.

Usage

partition(data, ratio = c(0.7, 0.3), set.seed = NULL)

Value

a list which includes the data partitions.

Arguments

data

an (\(n \times p\)) matrix or a data.frame.

ratio

a numerical vector in range of [0, 1].

set.seed

a single value, interpreted as an integer, or NULL.

Author

Reza Mohammadi a.mohammadi@uva.nl and Kevin Burke kevin.burke@ul.ie

Examples

Run this code
data(iris)

partition(data = iris, ratio = c(0.7, 0.3))

Run the code above in your browser using DataLab