library(dplyr)
library(parsnip)
library(broom)
data <- filter(example_nested_data, id %in% 1:5)
model <- linear_reg() %>%
set_engine("lm") %>%
nested()
fit <- fit(
model, z ~ x + y + a + b,
group_by(data, id)
)
tidy(fit)
glance(fit)
glance_nested(fit)
Run the code above in your browser using DataLab