Subsetting based on values of a different data frame in R

后端 未结 4 975
一向
一向 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:08

    If I rename your matrices amat and bmat, then

    amat[which(sapply(1:nrows(amat),function(x) prod(amat[x,]>bmat[x,]))==1),]
    [1] 10 10
    

    And you can paste the 'hours' row back on if desired.

提交回复
热议问题