Summarizing multiple variables in 1957
The summarize() verb allows you to summarize multiple variables at once. In this case, you'll use the median() function to find the median life expectancy and the max() function to find the maximum GDP per capita.
Latihan ini adalah bagian dari kursus
Introduction to the Tidyverse
Petunjuk latihan
- Find both the median life expectancy (
lifeExp) and the maximum GDP per capita (gdpPercap) in the year 1957, calling themmedianLifeExpandmaxGdpPercaprespectively. You can use themax()function to find the maximum.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
library(gapminder)
library(dplyr)
# Filter for 1957 then summarize the median life expectancy and the maximum GDP per capita