開始使用免費開始

找出只出現在單一資料表的觀測值

你的 R 工作階段中另外載入了一個 data.tablemiddle_east,以及上一個練習中的 gdp 資料表清單。middle_east 資料表包含中東地區的國家;中東是一個橫跨歐洲、非洲與亞洲的地緣政治區域。middle_east 中的所有國家都出現在 gdp 清單中的一個或多個資料表裡。你的目標是印出數個資料表,內容為非洲、歐洲與亞洲中,不在 middle_east 裡的所有國家。

本練習屬於課程

R 的 data.table 資料合併

檢視課程

練習說明

  • 印出一個新的 data.table,內容為 gdp$africa 中不在 middle_east 的列。
  • 印出一個新的 data.table,內容為 gdp$asia 中不在 middle_east 的列。
  • 印出一個新的 data.table,內容為 gdp$europe 中不在 middle_east 的列。

動手互動練習

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

# Which countries are in Africa but not considered part of the middle east?
___

# Which countries are in Asia but not considered part of the middle east?
___

# Which countries are in Europe but not considered part of the middle east?
___
編輯並執行程式碼