Implementation of skyline query or efficient frontier

前端 未结 6 1782
慢半拍i
慢半拍i 2020-12-06 02:44

I know there must be an easy answer to this but somehow I can\'t seem to find it...

I have a data frame with 2 numeric columns. I would like to remove from it, the r

6条回答
  •  借酒劲吻你
    2020-12-06 03:01

    In one line:

    d <- matrix(c(2, 3, 4, 7, 5, 6), nrow=3, byrow=TRUE)
    d[!apply(d,1,max)

    Edit: In light of your precision in jbaums' response, here's how to check for both columns separately.

    d <- matrix(c(2, 3, 3, 7, 5, 6, 4, 8), nrow=4, byrow=TRUE)
    d[apply(d,1,min)>min(apply(d,1,max)) ,]
    
         [,1] [,2]
    [1,]    5    6
    [2,]    4    8
    

提交回复
热议问题