開始使用免費開始

使用 inner_join 合併資料集

在第 1 章中,你建立了 votes_processed 資料集,內含各國投票的資訊。現在你要把它與新的 descriptions 資料集合併;其中包含每個國家的議題資訊,方便你針對特定議題分析投票情形。

為了完成這件事,你會使用 dplyrinner_join() 函式。

本練習屬於課程

案例研究:R 中的探索性資料分析

檢視課程

練習說明

  • 載入 dplyr 套件。
  • 印出 votes_processed 資料集。
  • 印出新的 descriptions 資料集。
  • 使用 dplyr 的 inner_join(),以 rcidsession 欄位進行比對,將兩個資料集合併。將結果存為 votes_joined

動手互動練習

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

# Load dplyr package


# Print the votes_processed dataset


# Print the descriptions dataset


# Join them together based on the "rcid" and "session" columns
編輯並執行程式碼