彙總 1957 年的多個變數
summarize() 動詞可讓你一次彙總多個變數。這裡你會用 median() 計算壽命中位數,並用 max() 找出人均 GDP 的最大值。
本練習屬於課程
Tidyverse 入門
練習說明
- 找出 1957 年的壽命中位數(
lifeExp)與人均 GDP 的最大值(gdpPercap),並分別命名為medianLifeExp與maxGdpPercap。你可以使用max()來取得最大值。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
library(gapminder)
library(dplyr)
# Filter for 1957 then summarize the median life expectancy and the maximum GDP per capita