Check if elements in one object are present in another object
You want to check which of the elements in a vector, matrix, list, or data frame are present in another vector, matrix, list or data frame
%in% operator checks if each of the elements in the object on the left-hand side has a match among the elements in the object on the right-hand side.
See rule 2.6 in The R Primer for more information.
Back to tips.