%in% operator compares a vector with a set.
v = "A" w = c("A", "A") w %in% v # TRUE TRUE v %in% w # TRUE
Each element on the left is treated individually and tested for membership in the set associated with the vector on the right (consisting of all its distinct elements).
Unlike equality tests,
%in% always returns
c(1, NA) %in% c(1, 2, 3, 4) # TRUE FALSE
The documentation is at