Join two datasets based on an inequality condition

前端 未结 3 987
抹茶落季
抹茶落季 2021-01-16 11:21

I have used the call below to \"join\" my datasets based on an inequality condition:

library(sqldf)

sqldf(\"select *
from dataset1 a,
dataset2 b
a.col1 <         


        
3条回答
  •  無奈伤痛
    2021-01-16 11:53

    You could definitely do it in two steps utilizing merge.

    Example (the exact details of the merge are up to you):

    lessRows <- which(df1$col1 < df2$col2)
    df3 <- merge(df1, df2)[lessRows, ]
    

提交回复
热议问题