Implementation of skyline query or efficient frontier

前端 未结 6 1787
慢半拍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:11

    This question is pretty old, but meanwhile there is a new solution. I hope it is ok to do some self-promotion here: I developed a package rPref which does an efficient Skyline computation due to C++ algorithms. With installed rPref package the query from the question can be done via (assuming that df is the name of data set):

    library(rPref)
    psel(df, high(Col1) | high(Col2))
    

    This removes only those tuples, where some other tuple is better in both dimensions.

    If one requires the other tuple to be strictly better in just one dimension (and better or equal in the other dimension), use high(Col1) * high(Col2) instead.

提交回复
热议问题