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