Removing row with duplicated values in all columns of a data frame (R)

后端 未结 1 525
忘掉有多难
忘掉有多难 2020-12-12 01:48

With the following data frame:

d <- structure(list(n = c(2, 3, 5), s = c(2, 8, 3),t = c(2, 18, 30)), .Names = c(\"n\", \"s\",\"t\"), row.names = c(NA, -3L         


        
相关标签:
1条回答
  • 2020-12-12 02:35

    Here's one possible approach, which compares all columns to the first

    d[rowSums(d == d[,1]) != ncol(d),]
    #   n s  t
    # 2 3 8 18
    # 3 5 3 30
    
    0 讨论(0)
提交回复
热议问题