data(Sacramento, package = "modeldata")
rec <-
recipe(~ city + zip, data = Sacramento) %>%
step_unknown(city, new_level = "unknown city") %>%
step_unknown(zip, new_level = "unknown zip") %>%
prep()
table(bake(rec, new_data = NULL) %>% pull(city),
Sacramento %>% pull(city),
useNA = "always"
) %>%
as.data.frame() %>%
dplyr::filter(Freq > 0)
tidy(rec, number = 1)
Run the code above in your browser using DataLab