過濾與排序
我們常會同時對資料集做過濾與排序,讓你能聚焦在特定重點觀察上。這裡,你要找出在人口於民間部門就業比例上,屬於極端案例的郡縣。
本練習屬於課程
使用 dplyr 進行資料操作
練習說明
- 篩選位於德州(Texas)、人口超過一萬人(
10000)的郡縣,並依民間就業比例由高到低排序。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
counties_selected <- counties %>%
select(state, county, population, private_work, public_work, self_employed)
# Filter for Texas and more than 10000 people; sort in descending order of private_work
counties_selected %>%
# Filter for Texas and more than 10000 people
___ %>%
# Sort in descending order of private_work
___