開始使用免費開始

依區域計數

counties 資料集包含區域、州別、人口與公民數等欄位;我們已經挑選並另存為 counties_selected 資料表。本練習要聚焦在 region 欄位。

counties_selected <- counties %>%
  select(county, region, state, population, citizens)

本練習屬於課程

使用 dplyr 進行資料操作

檢視課程

練習說明

  • 使用 count() 計算各區域的郡縣數,並加入第二個引數以依遞減順序排序。

動手互動練習

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

# Use count to find the number of counties in each region
counties_selected %>%
  ___
編輯並執行程式碼