Exercise

鑽研 subset() 函數

前面練習示範的刪除欄位只是 subset() 函數的其中一個功能。subset() 函數在篩選觀測值與變數非常實用,假如你想快速看到草帽魯夫的懸賞金額,可以練習在 R Console 輸入:

subset(straw_hat_df, name == "Monkey D. Luffy", select = c(name, bounty))

Instructions

100 XP
  • 將草帽海賊團賞金大於 1000 萬貝里並且年齡小於 30 歲的成員篩選出來,欄位只需要包含姓名、賞金與年齡。