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

前端 未结 3 1550
忘了有多久
忘了有多久 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:17

    Try it

    library(dplyr)
    
    DF1 <- data.frame(Part = c(1,2,3,4,5), Age = c(23,34,23,25,24),  B.P = c(87,76,75,75,78))
    
    DF2 <- data.frame(Part =c(3,5), Age = c(23,24), B.P = c(75,78))
    
    DF3 <- rbind(DF1,DF2)
    
    DF3 <- DF3[!(duplicated(DF3) | duplicated(DF3, fromLast = TRUE)), ]
    

提交回复
热议问题