• 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.

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

remove_formula(x)

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

## Arguments

x A workflow 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. 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

workflow <- workflow()
workflow <- add_formula(workflow, mpg ~ cyl)
workflow#> ══ Workflow ════════════════════════════════════════════════════════════════════
#> Preprocessor: Formula
#> Model: None
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> mpg ~ cyl
remove_formula(workflow)#> ══ Workflow ════════════════════════════════════════════════════════════════════
#> Preprocessor: None
#> Model: None
update_formula(workflow, mpg ~ disp)#> ══ Workflow ════════════════════════════════════════════════════════════════════
#> Preprocessor: Formula
#> Model: None
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> mpg ~ disp