iris %>% dummy_dt(Species)
iris %>% dummy_dt(Species,longname = FALSE)
mtcars %>% head() %>% dummy_dt(vs,am)
mtcars %>% head() %>% dummy_dt("cyl|gear")
# when there are NAs in the column
df <- data.table(x = c("a", "b", NA, NA),y = 1:4)
df %>%
dummy_dt(x)
# when NA and "NA" both exist, they would be merged
df <- data.table(x = c("a", "b", NA, "NA"),y = 1:4)
df %>%
dummy_dt(x)
Run the code above in your browser using DataLab