我有一个表1,其中包含以下格式的每一行:
<ID> <Key1> OR <Key2> OR <Key3> OR <Key4>
另一个表2包含以下格式的键值对:
<Key 1> <Value 1> <Key 2> <Value 2>
我想查找表1中的每一个,并替换为表2中相应的。两个表中的行数都大于30k您建议用什么方法在列之间查找数据?表格存放在excel中,但我正在寻找任何工具的指导
n3ipq98p1#
我当然不是一个rMaven,但你不只是做一个分裂和合并吗?或者这是过于简单化了?
X <- split(df, df$g) str(X) Inner join: merge(df1, df2) Outer join: merge(x = df1, y = df2, by = "CustomerId", all = TRUE) Left outer: merge(x = df1, y = df2, by = "CustomerId", all.x = TRUE) Right outer: merge(x = df1, y = df2, by = "CustomerId", all.y = TRUE) Cross join: merge(x = df1, y = df2, by = NULL)
1条答案
按热度按时间n3ipq98p1#
我当然不是一个rMaven,但你不只是做一个分裂和合并吗?或者这是过于简单化了?