J'ai ce qui suit, mais je veux ajouter l'option group_by()
clé Species
au tibble résultant :
MWE
iris %>%
group_by(Species) %>%
group_map(~ broom::tidy(lm(Sepal.Length ~ Sepal.Width, data = .x))) %>%
bind_rows()
Sortie
# How do I add the grouping key `Species` to this?
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 2.64 0.310 8.51 3.74e-11
2 Sepal.Width 0.690 0.0899 7.68 6.71e-10
3 (Intercept) 3.54 0.563 6.29 9.07e- 8
4 Sepal.Width 0.865 0.202 4.28 8.77e- 5
5 (Intercept) 3.91 0.757 5.16 4.66e- 6
6 Sepal.Width 0.902 0.253 3.56 8.43e- 4