library(dplyr)
library(parsnip)
library(recipes)
library(workflows)
data <- filter(example_nested_data, id %in% 11:20)
model <- linear_reg() %>%
set_engine("lm") %>%
nested()
recipe <- recipe(data, z ~ x + y + id) %>%
step_nest(id)
wf <- workflow() %>%
add_recipe(recipe) %>%
add_model(model)
fit(wf, data)
Run the code above in your browser using DataLab