# NOT RUN {
library(modeldata)
data(okc)
rec <- recipe(~ diet + location, data = okc)
make_factor <- rec %>%
step_string2factor(diet)
make_factor <- prep(make_factor,
training = okc,
strings_as_factors = FALSE)
# note that `diet` is a factor
juice(make_factor) %>% head
okc %>% head
tidy(make_factor, number = 1)
# }
Run the code above in your browser using DataLab