Subsetting based on values of a different data frame in R

后端 未结 4 977
一向
一向 2021-01-19 04:59

I want to subset data if every value in the row is greater than the respective row in a different data frame. I also need to skip some top rows. These previous questions did

4条回答
  •  情歌与酒
    2021-01-19 05:01

    I think it is better to use SQL for such inter table filtering. It is clean and readable( You keep the rules logic).

     library(sqldf)
    sqldf('SELECT DISTINCT A.*
            FROM A,B
            WHERE A.name1   > B.name1
            AND    A.name2  > B.name2')
      name1 name2
    1   trt  ctrl
    2    10    10
    

提交回复
热议问题