0

I want to remove all duplicate rows in my data set whose have the same value in in columns 1,4,5 of my data set. I did the following :

 cols <- c(col1,col4,col5)
 NonJointTrip<-CLEANED[!duplicated(CLEANED[cols]) | duplicated(CLEANED[cols], fromLast = TRUE), ]

my problem is that this code keep one of rows and delete the others one. I need a code which don't keep even one row. here is an example

     col1  col2   col3  col4  col5
       1    2      3     4     5
       1    3      5     4     5
       3    2      1     7     8

the first and lsecond rows have the same value in col1,col4,col5, the above code remove one of them and gives me

     col1  col2   col3  col4  col5
       1    2      3     4     5
       3    2      1     7     8

But I want both rows to be deleted and give me:

     col1  col2   col3  col4  col5
       3    2      1     7     8
sherek_66
  • 501
  • 5
  • 14

0 Answers0