getBalancedCVFoldIDs: For binary outcomes. Create a vector of (integer) fold...

View source: R/utilities.R

getBalancedCVFoldIDsR Documentation

For binary outcomes. Create a vector of (integer) fold assignments with equal numbers of cases (and controls) across folds. Used to ensure there are as many cases as possible in all folds, particularly in imbalanced datasets.

Description

For binary outcomes. Create a vector of (integer) fold assignments with equal numbers of cases (and controls) across folds. Used to ensure there are as many cases as possible in all folds, particularly in imbalanced datasets.

Usage

getBalancedCVFoldIDs(data, classColname, nFolds, seed = NULL)

Arguments

data

A dataframe containing a column specified by classColname

classColname

A string corresponding to the binary class label (must contain only integers: 1 and 0)

nFolds

The number of folds to assign

seed

An integer to set for the random seed

Value

A vector of integers specifying the fold ID assigned to each row in data


marioni-group/MethylPipeR documentation built on Oct. 10, 2024, 3:32 p.m.