I am working on creating a Random Forest model using the tidymodels approach. In the recipe function, I get this error/warning that I simply cannot interpret, but it must be something related to the summary variables created. The error is
There are new levels in a factor: NA
So, for now my recipe arguments looks like this:
era.af.Al_rec <- recipes::recipe(logRR ~., data = era.af.Al_predict) %>%
step_mutate_at(logRR, SubPrName, PrName, Product, AEZ16simple, fn = factor) %>%
update_role(ID, new_role = "ID") %>%
update_role(RR_group, new_role = "ID") %>%
step_other(SubPrName, PrName, Product, AEZ16simple, threshold = 0.01) %>%
step_other(Site.ID, threshold = 0.001) %>%
step_dummy(all_nominal(), -all_outcomes()) %>%
step_downsample(logRR)
era.af.Al_prep <- prep(era.af.Al_rec)
juiced <- juice(era.af.Al_prep)
The error pops up in the _prep call.