complete_levels: Create a data.frame with all factor or character levels

Description Usage

View source: R/complete_levels.R


model.matrix and get_predicted break when newdata includes a factor variable, but not all levels are present in the data. This is bad for us because we often want to get predictions with one (or few) rows, where some factor levels are inevitably missing.


complete_levels(x, levels_character = NULL)

marginaleffects documentation built on Oct. 19, 2021, 1:09 a.m.