rSplit {Qindex}R Documentation

Stratified Random Split Sampling

Description

Random split sampling, stratified based on the type of the response.

Usage

rSplit(y, nsplit, stratify = TRUE, s_ratio = 0.8, ...)

Arguments

y

a double vector, a logical vector, a factor, or a Surv object, response y

nsplit

positive integer scalar, number of replicates of random splits to be performed

stratify

logical scalar, whether stratification based on response y needs to be implemented, default TRUE

s_ratio

double scalar between 0 and 1, split ratio, i.e., percentage of training subjects p, default .8

...

additional parameters, currently not in use

Details

Function rSplit performs random split sampling, with or without stratification. Specifically,

Value

Function rSplit returns a length-nsplit list of logical vectors. In each logical vector, the TRUE elements indicate training subjects and the FALSE elements indicate test subjects.

Note

caTools::sample.split is not what we need.

See Also

split, caret::createDataPartition

Examples

rSplit(y = rep(c(TRUE, FALSE), times = c(20, 30)), nsplit = 3L)


[Package Qindex version 0.1.7 Index]