Skip to content

Instantly share code, notes, and snippets.

@jthomasmock
Last active March 2, 2018 14:48
Show Gist options
  • Save jthomasmock/2c76f138bbd2008c275ca0ec863e11d6 to your computer and use it in GitHub Desktop.
Save jthomasmock/2c76f138bbd2008c275ca0ec863e11d6 to your computer and use it in GitHub Desktop.
With tidyverse, purrr and writexl, you can generate many models simultaneously and save them to individual sheets in Excel!
library(tidyverse)
library(writexl)
library(broom)
mtcars %>%
select(disp:wt) %>%
map(~ summary(lm(.x ~ factor(cyl) * factor(am), data = mtcars))) %>%
map( ~ tidy(.x)) %>%
writexl::write_xlsx(., "mtcars_example.xlsx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment