标签: r dplyr
我意识到dplyr v3.0允许你加入不同的变量:
dplyr
left_join(x, y, by = c("a" = "b")会将x.a与y.b
left_join(x, y, by = c("a" = "b")
x.a
y.b
但是,是否可以加入变量组合或者我必须事先添加复合键?
这样的事情:
left_join(x, y, by = c("a c" = "b d")以匹配[x.a和x.c]与[y.b和y.d]
left_join(x, y, by = c("a c" = "b d")
x.c
y.d
答案 0 :(得分:144)
您可以将长度大于1的命名向量传递给by的{{1}}参数:
by
left_join()