Accounts for missing factor levels present only in test data but not in train data by setting values to NA
remove_missing_levels(fit, test_data)
fit | fitted model on training data |
---|---|
test_data | data to make predictions for |
data.frame with matching factor levels to fitted model