Hi,
I have the following dataset:
ID Visite 200 other Variables
1 1
1 2
1 4
1 4
1 5
1 6
2 1
2 2
2 3
2 4
2 4
2 6
2 7
3 1
3 2
3 2
3 3
3 4
3 5
4 1
4 2
4 3
- I would like to see which IDs contain duplicates in Visite (here: 1: 2x4; 2: 2x4; 3: 2x3)
- I would like to change the duplicates to the lower Visite if e.g. at ID 1 visite 4 or the lower visit is missing, to the higher visite if e.g. at ID 2 visite 5 or the higher visit is missing, or delete one whole row including all other values of a person if there is a duplicate but no adjacent visit is missing.
Could you please help me? I tried some codes but nothing worked.
Thank you.
Best
Christina