我想做条件合并。我有两个数据集a
和b
,我想合并它们以获取数据集D
。问题是两个数据集的ID不匹配,但它们在相同的日期和时间。我怎么能这样做?
X=c("A","B")
S=c("p", "A")
ID= c(1234,2456)
date=c("23/1/2017 9:00","23/1/2017 9:00 ")
a=data.frame(cbind(X,S,ID,date))
X=c("A","B")
C=c(10, 200)
ID= c(1234,1234)
b=data.frame(cbind(X,C,ID))
X=c("A","B")
S=c("p", "A")
ID= c(1234,2456)
date=c("23/1/2017 9:00","23/1/2017 9:00 ")
C=c(10, 200)
D=data.frame(cbind(X,S,ID,date, C))