superspread | R Documentation |
Creates dummy variables from multiple categorical variables. Uses data.table() for speed (enhanced from the previous version) Uses dplyr select() special functions to select categorical variables.
superspread(df, select_helpers)
df |
Data frame containing the multiple categorical variables. |
select_helpers |
Uses dplyr-style select functions to select multiple variables. Use everything() to select all variables. These variables must all be character type. |
Other superspread functions:
superspread_count()
superspread(iris,"Species")
## Not run:
library(data.table)
library(dplyr)
dt <- data.table(id = 1:10000,
cat1 = sample(letters[1:3],10000,replace = TRUE),
cat2 = sample(letters[1:4],10000,replace = TRUE),
cat3 = sample(letters[1:5],10000,replace = TRUE))
dt <- as.data.table(dt)
superspread(df = dt, select_helpers = contains("cat"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.