I have the following problem and I don't know where to start in R: I have two columns with the same information, but one column contains some additional information. I want both columns to be exactly the same. Here is an example:
1 1
1 1
2 1
2 2
3 2
3 2
4 2
4 3
5 3
5 3
4
4
4
5
5
5
5
5
Thus, some numbers in the second column must be deleted, so that both columns have equal length and have in each row the same number. I guess there is a possibility to construct a loop and tell R to delete the number in the second column until column1 = column2
.
But I don't know where to start with. Is there even a possibility that R reads automatically the two columns and deletes if the two rows don't match?