Created
September 1, 2020 10:46
-
-
Save keithmcnulty/c24edb0513add74d12f99324d1e0f58b 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
penguin_stats <- penguins %>% | |
dplyr::group_by(species) %>% | |
dplyr::summarise(across(ends_with("mm"), # do this for any column ending in mm | |
list(~mean(.x, na.rm = TRUE), ~sd(.x, na.rm = TRUE)))) # calculate a mean and sd | |
penguin_stats | |
# A tibble: 3 x 7 | |
species bill_length_mm_1 bill_length_mm_2 bill_depth_mm_1 bill_depth_mm_2 flipper_length_mm_1 flipper_length_mm_2 | |
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> | |
1 Adelie 38.8 2.66 18.3 1.22 190. 6.54 | |
2 Chinstrap 48.8 3.34 18.4 1.14 196. 7.13 | |
3 Gentoo 47.5 3.08 15.0 0.981 217. 6.48 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment