開始使用免費開始

以洲別視覺化各國人均 GDP 中位數

長條圖很適合用來視覺化摘要統計量,例如各洲的人均 GDP 中位數。

本練習屬於課程

Tidyverse 入門

檢視課程

練習說明

  • 使用 group_by()summarize() 找出 1952 年各洲的人均 GDP 中位數,並將輸出欄位命名為 medianGdpPercap。使用指定運算子 <- 把結果儲存成名為 by_continent 的資料集。
  • 使用 by_continent 資料集建立長條圖,顯示各洲的人均 GDP 中位數。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

library(gapminder)
library(dplyr)
library(ggplot2)

# Summarize the median gdpPercap by continent in 1952


# Create a bar plot showing medianGdp by continent
編輯並執行程式碼