Description Usage Arguments Value See Also Examples
View source: R/data_transformation.R
one_hot_encoding
is for converting the factor or character variables into multiple columns
1 2 3 4 5 6 7 8 |
dat |
A dat frame. |
cat_vars |
The name or Column index list to be one_hot encoded. |
ex_cols |
Variables to be excluded, use regular expression matching |
merge_cat |
Logical. If TRUE, to merge categories greater than 8, default is TRUE. |
na_act |
Logical,If true, the missing value is processed, if FALSE missing value is omitted . |
note |
Logical.Outputs info.Default is TRUE. |
A dat frame with the one hot encoding applied to all the variables with type as factor or character.
1 2 3 4 5 | dat1 = one_hot_encoding(dat = UCICreditCard,
cat_vars = c("SEX", "MARRIAGE"),
merge_cat = TRUE, na_act = TRUE)
dat2 = de_one_hot_encoding(dat_one_hot = dat1,
cat_vars = c("SEX","MARRIAGE"), na_act = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.