我有两个不同的数据:
(1)
name age like
a1 12 game
a2 15 photo
a3 18 art
a4 11 photo
.
.
(2)
like color money
photo red 10
art yellow 20
game green 30
.
.
.
如何将这些数据合并到.csv文件中? (“喜欢”)
name age like color money
a1 10 game green 30
a2 15 photo red 10
a3 18 art yellow 20
a4 11 photo red 10
答案 0 :(得分:2)
使用data.table
library(data.table)
dt1 = as.data.table(df1, key="like")
dt2 = as.data.table(df2, key="like")
dt1[dt2]