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

cvseg

Get CV segments


Description

Get cross-validation segments that have (as far as possible) the same ratio of all classes (if classes are present)

Usage

cvseg(x, fold = 7, seed = NULL)

Arguments

x

a factor, character or numeric vector that describes class membership of a set of items, or, a numeric vector indicating unique indices of items, or, a numeric of length 1 that describes the number of items to segment (without any classes)

fold

the desired number of segments

seed

randomization seed for reproducibility

Value

a list where each element is a set of indices that defines the CV segment.

Author(s)

Henning Redestig

See Also

the cvsegments function in the pls package

Examples

seg <- cvseg(iris$Species, 10)
sapply(seg, function(s) table(iris$Species[s]))
cvseg(20, 10)

pcaMethods

A collection of PCA methods

v1.82.0
GPL (>= 3)
Authors
Wolfram Stacklies, Henning Redestig, Kevin Wright
Initial release

We don't support your browser anymore

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