step_dummy | R Documentation |
dummy encode a factor or factor like variable.
step_dummy(
.rec,
terms,
one_hot = FALSE,
role = "predictor",
skip = FALSE,
keep_original_cols = FALSE,
...
)
.rec |
the R6 recipe object. |
terms |
the unquoted names of the variables to use or a selector function. terms replaces the '...' of the recipes package but requires variables to be included within 'c()'. For example to include variables x and y you would write 'c(x,y)' in the hydrorecipes package. |
one_hot |
logical - use one hot encoding. |
role |
character - the name of the role |
skip |
logical - should the step be skipped |
keep_original_cols |
logical - keep the original columns or replace them |
... |
additional arguments |
an updated recipe
dat <- data.frame(x = qF(sample(1:10, 100, replace = TRUE)),
y = rnorm(100))
rec <- recipe(y~x, data = dat) |>
step_dummy(x, one_hot = FALSE)
rec <- recipe(y~x, data = dat) |>
step_dummy(x, one_hot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.