one_hot_encoding
is for converting the factor or character variables into multiple columns
one_hot_encoding(dat, cat_vars = NULL, ex_cols = NULL,
merge_cat = TRUE, na_act = TRUE, note = FALSE)
A dat frame.
The name or Column index list to be one_hot encoded.
Variables to be excluded, use regular expression matching
Logical. If TRUE, to merge categories greater than 8, default is TRUE.
Logical,If true, the missing value is processed, if FALSE missing value is omitted .
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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab