如何在r中左加入[重复]
Posted
技术标签:
【中文标题】如何在r中左加入[重复]【英文标题】:How to do Left join in r [duplicate] 【发布时间】:2016-09-11 04:06:19 【问题描述】:我有两个数据集一和二
数据集一
a b c
111 a 1
112 b 2
113 c 3
114 d 4
115 e 5
数据集二
e d g
222 ss 11
111 ff 22
113 ww 33
114 qq 44
234 dd 55
534 vv 66
我想做一个左连接
下面是用 SQL 编写的代码,但是当我在 SQLDF 中尝试它时,它显示为错误
proc sql;
create table join1 as
select one.*, two.*
from one left join two
on one.a = two.e;
quit;
【问题讨论】:
【参考方案1】:使用dplyr
,我们可以使用left_join
library(dplyr)
left_join(df2, df1, by = c("e"="a"))
【讨论】:
以上是关于如何在r中左加入[重复]的主要内容,如果未能解决你的问题,请参考以下文章