Created
March 2, 2020 14:48
-
-
Save hadley/22034af79b14b7852269c8ba31d0099d 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) | |
library(gapminder) | |
probs <- c(0.1, 0.5, 0.9) | |
gapminder %>% | |
group_by(continent) %>% | |
summarise( | |
probs = probs, | |
across(is.numeric & !year, ~ quantile(.x, probs)) | |
) | |
#> # A tibble: 15 x 5 | |
#> continent probs lifeExp pop gdpPercap | |
#> <fct> <dbl> <dbl> <dbl> <dbl> | |
#> 1 Africa 0.1 38.4 489931. 534. | |
#> 2 Africa 0.5 47.8 4579311 1192. | |
#> 3 Africa 0.9 60.8 26426121. 4857. | |
#> 4 Americas 0.1 50.6 1770851. 2321. | |
#> 5 Americas 0.5 67.0 6227510 5466. | |
#> 6 Americas 0.9 74.9 57318302. 12519. | |
#> 7 Asia 0.1 42.9 1310774 680. | |
#> 8 Asia 0.5 61.8 14530830. 2647. | |
#> 9 Asia 0.9 74.2 123822278. 20742. | |
#> 10 Europe 0.1 65.9 1997695 4206. | |
#> 11 Europe 0.5 72.2 8551125 12082. | |
#> 12 Europe 0.9 78.3 55026110. 28415. | |
#> 13 Oceania 0.1 70.3 2560430 11330. | |
#> 14 Oceania 0.5 73.7 6403492. 17983. | |
#> 15 Oceania 0.9 79.9 18240263. 26454. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment