How to check if a vector contains a given value?
You can use the %in% operator:
%in%
vec <- c(1, 2, 3, 4, 5) 1 %in% vec # true 10 %in% vec # false