Learn R Programming

contrastable (version 1.1.0)

.droplevels_as_needed: Drop missing levels

Description

Missing levels can cause unexpected behavior when fitting a model after setting contrasts. This function removes missing levels and informs the user of how many levels were dropped from each factor.

Usage

.droplevels_as_needed(model_data, lhs_variables, verbose = TRUE)

Value

model_data where existing factor columns have had any missing levels removed

Arguments

model_data

Model data

lhs_variables

variables specified for contrast coding from formulas

verbose

Should messages be sent? Defaults to TRUE