Subsetting based on values of a different data frame in R

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

    N <- nrow(A)
    cond <- sapply(3:N, function(i) sum(A[i,] > B[i,])==2)
    rbind(A[1:2,], subset(A[3:N,], cond))
    

提交回复
热议问题