Created
May 12, 2020 10:47
-
-
Save perlatex/9e334e97b8b80e25b5e7d7e908e7fec8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr, warn.conflicts = FALSE) | |
mtcars %>% | |
group_nest(cyl) %>% | |
mutate(model = purrr::map(data, ~ lm(mpg ~ wt, data = .))) %>% | |
mutate(result = purrr::map(model, ~ broom::tidy(.))) %>% | |
tidyr::unnest(result) | |
mtcars %>% | |
group_by(cyl) %>% | |
group_modify( | |
~ broom::tidy(lm(mpg ~ wt, data = .)) | |
) | |
mtcars %>% | |
nest_by(cyl) %>% | |
summarise( | |
broom::tidy(lm(mpg ~ wt, data = data)) | |
) | |
mtcars %>% | |
group_by(cyl) %>% | |
summarise( | |
broom::tidy(lm(mpg ~ wt, data = cur_data())) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment