Description Usage Arguments Examples
View source: R/recipes_utils.R
Add one or more steps to the end of a recipe object in sequence.
1 | add_steps(recipe, new_steps)
|
recipe |
A |
new_steps |
A series of step expressions. Use |
1 2 3 4 5 6 7 8 9 10 11 12 | library(recipes)
library(rlang)
pred_date <- as.Date("2015-01-15")
mtcars2 <- mtcars %>% mutate(hp_date = as.Date("2015-01-01"))
mtcars2$hp_date[1:2] <- as.Date("2015-02-01")
rec1 <- recipe(mtcars2, mpg ~ hp + hp_date)
new_steps <- exprs(
step_mutate(hp = ifelse(hp_date < pred_date, hp, as.numeric(NA))),
step_meanimpute(hp)
)
rec2 <- add_steps(rec1, new_steps)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.