library(parsnip)
library(tidyflow)
# Define two competing model:
lm_model <- set_engine(linear_reg(), "lm")
regularized_model <- set_engine(lm_model, "glmnet")
# Define a minimal tidyflow: data + formula + model
wf <-
mtcars %>%
tidyflow() %>%
plug_formula(mpg ~ .) %>%
plug_model(lm_model) %>%
fit()
reg_fitted <-
wf %>%
replace_model(regularized_model) %>%
fit()
#> Error: `data` must be a data.frame or a matrix, not a list.