One-hot encodes a dataframe whose features are all categorical

onehot(encodable_df)

Arguments

encodable_df

data.frame A dataframe of categorical features.

Value

data.frame Returns the same dataframe with useful column names and one-hot encoded features

Examples

my_data <- data.frame(animals = c('monkey', 'dog', 'cat')) onehot(my_data)
#> cat dog monkey #> 1 0 0 1 #> 2 0 1 0 #> 3 1 0 0