balancedSplit: Split a dataset into training and testing sets, balancing a...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

When performing cross-validation on a dataset, it often becomes necessary to split the data into training and test sets that are balanced for a certain binary outcome. This function implements such a balanced split.

Usage

1
balancedSplit(fac, size)

Arguments

fac

A factor that should be balnced between the two subsets.

size

A number between 0 and 1 indicating the fraction of the dataset to be used for training.

Details

Stuff should go here

Value

Returns a logical vector with length equal to the length of fac. TRUE values designate samples selected for the training set.

Author(s)

Kevin R. Coombes <krc@silicovore.com>

See Also

CrossVal, CrossVal-class, CrossVal-package.

Examples

1
2
3
4
5
nFeatures <- 40
nSamples <- 2*10
dataset <- matrix(rnorm(nSamples*nFeatures), ncol=nSamples)
groups <- factor(rep(c("A", "B"), each=10))
balancedSplit(dataset, groups)

CrossVal documentation built on May 2, 2019, 5:47 p.m.