0

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?

Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
  • 1
    See 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

0 Answers0