Description Usage Arguments Value Examples
View source: R/categorical.split.R
Expand all factors (categorical variables) into multiple dummy variables whilst keeping all other variables in the df (if the factor only contains two levels then the factor will be turned into one dummy variable with only 1/0 instead of unnecessary expanding.)
1 | categorical.split(dataframe)
|
dataframe |
a data frame containing categorical variables for expansion |
A data frame
1 2 3 4 5 6 7 8 | ### An example dataset
customers <- data.frame(
id=c(10,20,30,40,50,60,70),
gender=c('male','female','female','male','female', 'female', 'male'),
mood=c('happy','sad','happy','sad','happy', "neutral", "neutral"),
outcome=c(1,1,0,0,0,0,1))
categorical.split(customers)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.