I am trying to use grep to test whether a vector of strings are present in an another vector or not, and to output the values that are present (the matching pat
grep
This should work:
grep(pattern = 'A1|A9|A6', x = myfile$Letter)
Or even more simply:
library(data.table) myfile$Letter %like% 'A1|A9|A6'