mercredi 4 février 2015

R - Compare lists and flag matches

I have 2 lists and I need to identify and then flag where there is a match between list 1 and list 2.


Example:



List 1 List 2
1 1
2 2
3 3
4 4
5 5
6
7
8
9
10


Desired Output:



List 1 Match
1 Y
2 Y
3 Y
4 Y
5 Y
6 N
7 N
8 N
9 N
10 N


I tried a combination of an if statement wrapped in a loop but that just produced negative result regardless of a match. Any help would be much appreciated!


Aucun commentaire:

Enregistrer un commentaire