Created
July 16, 2020 11:41
-
-
Save keithmcnulty/8485a772f7abef6d40c484659f8a828d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| mtcars %>% | |
| dplyr::nest_by(cyl) %>% | |
| dplyr::summarise( | |
| coefs = lm(mpg ~ disp + drat + carb, data = data)$coefficients, | |
| names = names(lm(mpg ~ disp + drat + carb, data = data)$coefficients) | |
| ) | |
| #> # A tibble: 12 x 3 | |
| #> # Groups: cyl [3] | |
| #> cyl coefs names | |
| #> <dbl> <dbl> <chr> | |
| #> 1 4 52.0 (Intercept) | |
| #> 2 4 -0.187 disp | |
| #> 3 4 -2.73 drat | |
| #> 4 4 3.45 carb | |
| #> 5 6 1.79 (Intercept) | |
| #> 6 6 0.0479 disp | |
| #> 7 6 1.96 drat | |
| #> 8 6 0.623 carb | |
| #> 9 8 19.6 (Intercept) | |
| #> 10 8 -0.0179 disp | |
| #> 11 8 1.38 drat | |
| #> 12 8 -0.743 carb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment