R で学ぶ data.table によるデータ結合
Scott Ritchie
Postdoctoral Researcher in Systems Genomics
右側の data.table の情報を左側の data.table に追加します
merge(x = demographics, y = shipping, by = "name", all.x = TRUE)

左側の data.table の情報を右側の data.table に追加します
merge(x = demographics, y = shipping, by = "name", all.y = TRUE)

# Right join
merge(x = demographics, y = shipping, by = "name", all.y = TRUE)
# Same as
merge(x = shipping, y = demographics, by = "name", all.x = TRUE)
merge() 関数では all、all.x、all.y のデフォルト値は FALSE です
help("merge") で引数のデフォルト値を確認できます
demographics に shipping を左結合:
merge(demographics, shipping, by = "name", all.x = TRUE)
demographics に shipping を右結合:
merge(demographics, shipping, by = "name", all.y = TRUE)
R で学ぶ data.table によるデータ結合