Is there a straight way to filter using dplyr::filter
given an specific vector?
I'm looking for something like the code below:
top.food <- c('pizza', 'bacon', 'burger')
filter(orders, dish == 'pizza' | dish == 'bacon' | dish == 'burger')
I've chosen a character vector but it could be of any class.
I've thought about using grepl as a logical predicate grepl(dish, top.food)
but it doesn't work since dish doesn't match a valid pattern (it takes just the 1st element).
Any ideas? thnx!