Search notes:

R: the %in% operator

Testing for occurence in a vector

%in% can be used to test wheather one or more elements of a vector occurs in another vector:
vec <- c('one', 'two', 'three', 'four', 'five')

'foo' %in% vec # FALSE
'two' %in% vec # TRUE

c('one', 'bar') %in% vec # TRUE FALSE
Github repository about-r, path: /operators/in/vector.R

See also

The match(…) function.
R operators

Index