让我们说我有这些数据。表:
dt1<- data.table(c("A","B","C"),c("G","H","I"),c(4,5,6))
dt2<- data.table(c("A","B","C"),c("D","E","F"),c(3,4,5))
我想做
select dt1.*,dt2.V2 from dt1 left join dt2 on
dt1.V1 = dt2.V1 and dt2.V3= dt1.V3 - 1
但是有data.table。有办法吗?
换句话说,我想在data.table中进行左连接,条件是dt1 $ V1 = dt2 $ V1和dt2 $ V3 -1 = dt1 $ V3。