In SQL, you can easily avoid multiple OR conditions if you're looking for many values of a particular variable (column) by using IN. For example :
SELECT * FROM colors WHERE color in ('Red', 'Blue', 'Green')
How would I do that in R? I am currently having to do it like this:
shortlisted_colors <- subset(colors, color == 'Red' | color == 'Blue' | color == 'Green')
What is a better way?
shortlisted_colors <- subset(colors, color %in% c('Red', 'Blue', 'Green'))