Subset with unique cases, based on multiple columns

前端 未结 7 2129
执笔经年
执笔经年 2020-12-04 12:06

I\'d like to subset a dataframe to include only rows that have unique combinations of three columns. My situation is similar to the one presented in this question, but I\'d

相关标签:
7条回答
  • 2020-12-04 13:03

    I know it's an very old question, but anyway thought that the obvious solution using the unique() function should also be presented here:

    unique(df[1:3])
    

    or specifiying columns by names:

    unique(df[c("v1","v2","v3)]
    

    ...and specifying rows:

    unique(df[,c("v1","v2","v3)]
    
    0 讨论(0)
提交回复
热议问题