data(Sacramento, package = "modeldata")
sacr_tr <- Sacramento[1:800, ]
sacr_te <- Sacramento[801:806, ]
sacr_te$city[3] <- "beeptown"
sacr_te$city[4] <- "boopville"
rec <- recipe(~ city + zip, data = sacr_tr)
rec <- rec %>%
step_novel(city, zip)
rec <- prep(rec, training = sacr_tr)
processed <- bake(rec, sacr_te)
tibble(old = sacr_te$city, new = processed$city)
tidy(rec, number = 1)
Run the code above in your browser using DataLab