library(dplyr)
library(tidyr)
library(parsnip)
data <- filter(example_nested_data, id %in% 1:5)
nested_data <- nest(data, data = -c(id, id2))
model <- linear_reg() %>%
set_engine("lm") %>%
nested()
fitted <- fit(model, z ~ x + y + a + b, nested_data)
augment(fitted, example_nested_data)
Run the code above in your browser using DataLab