split: split

Description Usage Arguments Value Examples

View source: R/RKSIR.R

Description

Split data randomly into training set and testing set

Usage

1
split(y, ns = NULL)

Arguments

y

response vector, must be 1,2,...

ns

a vector which contains the length of each class in the training data

Value

a vector

train

a vector which contains the number of data in the training set

Examples

1
2
3
4
5
6
## Not run: 
y <- c(rep(1, 7), rep(2, 10), rep(3, 12))
ns <- c(3, 4, 5)
split(y, ns)

## End(Not run)

zhaolotelli/SC19017 documentation built on Jan. 3, 2020, 9:19 p.m.