Q:

Combining %like% and %in% operators in R

How I can combine %like% with %in% operator in data.table?  I would like to find string pattern in any string in list, like:
list = c("aaa", "bbb", "ccc")

data[column1 %like% %in% list, column2]

which is of course not working. 

A:

Perhaps the grep based approach should work
data[grepl(paste(list, collapse='|'), column1)]

and if they are exact matches, just do
data[column1 %in% list]

