Learn R Programming

workflows (version 0.1.1)

add_formula: Add formula terms to a workflow

Description

  • add_formula() specifies the terms of the model through the usage of a formula.

  • remove_formula() removes the formula as well as any downstream objects that might get created after the formula is used for preprocessing, such as terms. Additionally, if the model has already been fit, then the fit is removed.

  • update_formula() first removes the formula, then replaces the previous formula with the new one. Any model that has already been fit based on this formula will need to be refit.

Usage

add_formula(x, formula, ..., blueprint = NULL)

remove_formula(x)

update_formula(x, formula, ..., blueprint = NULL)

Arguments

x

A workflow

formula

A formula specifying the terms of the model. It is advised to not do preprocessing in the formula, and instead use a recipe if that is required.

...

Not used.

blueprint

A hardhat blueprint used for fine tuning the preprocessing. If NULL, hardhat::default_formula_blueprint() is used.

Value

x, updated with either a new or removed formula preprocessor.

Details

To fit a workflow, one of add_formula() or add_recipe() must be specified, but not both.

Examples

Run this code
# NOT RUN {
workflow <- workflow()
workflow <- add_formula(workflow, mpg ~ cyl)
workflow

remove_formula(workflow)

update_formula(workflow, mpg ~ disp)
# }

Run the code above in your browser using DataLab