Andy Andy - 1 month ago 9
R Question

How do I view all duplicates across all rows?

I am running to a problem in my database where they accidentally have duplicate stuff of the same observation where all column/variable values are exactly the same, getting duplicates for that specific observation. How do I view all of these in R so I can investigate?


Answer Source

Since you didn't give any example data, I will give a general layout.

duplicates <- duplicated(df) | duplicated(df, fromLast = TRUE) 
duplicates_set <- subset(df, duplicates == TRUE)