How can I remove all duplicates so that NONE are left in a data frame?

前端 未结 3 1549
忘了有多久
忘了有多久 2020-11-22 08:31

There is a similar question for PHP, but I\'m working with R and am unable to translate the solution to my problem.

I have this data frame with 10 rows and 50 column

3条回答
  •  时光取名叫无心
    2020-11-22 09:30

    A possibility involving dplyr could be:

    df %>%
     group_by_all() %>%
     filter(n() == 1)
    

    Or:

    df %>%
     group_by_all() %>%
     filter(!any(row_number() > 1))
    

提交回复
热议问题