Skip to content

Do not allow fitted recipes #179

@topepo

Description

@topepo

Another thing that I've seen is that people prep a recipe then use add_recipe(). Can we error when that happens and add something to the man file for add_recipe()?

library(tidymodels)

training <- mtcars[1:20, ]
testing <- mtcars[21:32, ]

model <- linear_reg() %>%
  set_engine("lm")

workflow <- workflow() %>%
  add_model(model)

recipe <- recipe(mpg ~ cyl + disp, training) %>%
  step_log(disp) %>% 
  prep()

map_lgl(recipe$steps, is_trained)
#> [1] TRUE

workflow <- add_recipe(workflow, recipe)

fit_workflow <- fit(workflow, training)

Created on 2022-09-21 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions