I have a question regarding indentifying and separating duplicate rows in R. I have, say a 2 column dataset, and in one of them I check for duplicates. If it finds any, I want to create a dataset with BOTH OF THE ROWS of a duplicate, so I can go and check the issues with them. Is there any way to do this?
Asked
Active
Viewed 19 times
0
-
1See if [this FAQ answers your question](https://stackoverflow.com/q/7854433/903061). Something like `result = your_data[duplicated(your_data$your_column) | duplicated(your_data$your_column, fromLast = TRUE), ]`. – Gregor Thomas Nov 30 '20 at 13:37
-
If you have trouble or need more help, please post a reproducible sample of data in your question, preferably using `dput()` on an illustrative subset, e.g., `dput(your_data[1:10, ])` for the first 10 rows. – Gregor Thomas Nov 30 '20 at 13:38
-
Yes, thank you for your answer :) – Bence Racskó Nov 30 '20 at 13:42
-
My problem seems to be solved with the first comment, I just failed to add the second duplicated column to the result. – Bence Racskó Nov 30 '20 at 13:44