library(tibble)
languages <- tribble(
~lang_1, ~lang_2, ~lang_3,
"English", "Italian", NA,
"Spanish", NA, "French",
"Armenian", "English", "French",
NA, NA, NA
)
dummy_multi_choice_rec <- recipe(~., data = languages) %>%
step_dummy_multi_choice(starts_with("lang")) %>%
prep()
bake(dummy_multi_choice_rec, new_data = NULL)
tidy(dummy_multi_choice_rec, number = 1)
dummy_multi_choice_rec2 <- recipe(~., data = languages) %>%
step_dummy_multi_choice(starts_with("lang"),
prefix = "lang",
threshold = 0.2
) %>%
prep()
bake(dummy_multi_choice_rec2, new_data = NULL)
tidy(dummy_multi_choice_rec2, number = 1)
Run the code above in your browser using DataLab