Description Usage Arguments Value Examples
View source: R/column_transformer.R
Transforms columns in dataframe by the specified methods. Separate methods can be applied for categorical column transformation and numerical column transformation.
1 2 3 4 5 6 7 | column_transformer(
x_train,
x_test,
column_list,
num_trans = "standard_scaling",
cat_trans = "onehot_encoding"
)
|
x_train |
training set dataframe/tibble |
x_test |
test set dataframe/tibble |
column_list |
named list of categorical and numeric columns. |
num_trans |
method(character) for numerical transformation - Can take values "standard_scaling" or "minmax_scaling" (default = "standard_scaling") |
cat_trans |
method(character) for categorical transformation - Cant take values "onehot_encoding" or "label_encoding" (default = "onehot_encoding") |
A list with named items x_train and x_list that have been transformed according to the arguments specified
1 2 3 | x_train <- data.frame('x' = c(2.5, 3.3, 5,8), 'y' = factor(c(1, 6, 1,6)))
x_test <- data.frame('x' = c(2,1), 'y' = factor(c(1,6)))
column_transformer(x_train, x_test, list("numeric" = c('x'), "categorical" = c('y')))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.