Select 輔助函式
在影片中你學到了 select 的輔助函式 starts_with()。另一個輔助函式是 ends_with(),可以找出以特定字串結尾的欄位。
本練習屬於課程
使用 dplyr 進行資料操作
練習說明
- 選取
state、county、population,以及所有以work結尾的欄位。 - 只保留人口中至少有 50% 從事公共工作的郡。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
counties %>%
# Select the state, county, population, and those ending with "work"
___
# Filter for counties that have at least 50% of people engaged in public work
___