filter と arrange
データを特定の観点で絞り込み、並べ替えることは、関心のある観測に焦点を当てるためによく行います。ここでは、民間部門で働く人口の割合が極端に高い(または低い)郡を見つけます。
この演習はコースの一部です
dplyr で行うデータ操作
演習の手順
- テキサス州の郡のうち、人口が一万人(
10000)を超えるものに filter し、民間就業者の割合が高い順(降順)に並べ替えてください。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
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
___