# NOT RUN {
library(parsnip)
library(recipes)
training <- mtcars[1:20,]
testing <- mtcars[21:32,]
model <- linear_reg()
model <- set_engine(model, "lm")
workflow <- workflow()
workflow <- add_model(workflow, model)
recipe <- recipe(mpg ~ cyl + disp, training)
recipe <- step_log(recipe, disp)
workflow <- add_recipe(workflow, recipe)
fit_workflow <- fit(workflow, training)
# This will automatically `bake()` the recipe on `testing`,
# applying the log step to `disp`, and then fit the regression.
predict(fit_workflow, testing)
# }
Run the code above in your browser using DataLab