binarize: Convert categorical variables into binary dummies

Description Usage Arguments

View source: R/categorical.handling.R

Description

This function performs categorical variable binarization, which is handled in other libraries but in this case is performed with some particularities. Conditions with fewer than a specified number of subjects are combined into a single meta-group tagged "combined.other", which has undesirable statistical properties but at the very least is less likely to cause your downstream model to just implode.

Usage

1
binarize(df, minimum.factor.level.count, conditions)

Arguments

df

data.frame, source data frame containing model matrix data to be transformed

minimum.factor.level.count

numeric, number of subjects in a condition strictly below which the condition is merged into the catch-all meta group

conditions

list of logical vectors. each vector should be of length ncol(df), and should indicate whether a column passes a particular criterion for being included in the transformed set. each vector is effectively logically ORed together.


NCI-CGR/construct.model.matrix documentation built on Aug. 10, 2021, 8:53 a.m.