Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

### Problem

I keep forgetting how to select all elements of an object except a few, by name. I get the ! operator confused with the - operator and I find both of them less than intuitive to use. How can I negate the %in% operator?

### Context

I have a data frame called electrofishing that contains observations from a fish sampling survey. One column, stratum, gives the aquatic habitat type of the sampling site. I’d like to exclude observations sampled in the “Tailwater Zone” or “Impounded-Offshore” areas.

My instinct would be to do this:

### Resources

https://stackoverflow.com/questions/38351820/negation-of-in-in-r

This one does a good job of explaining why !%in% doesn’t work:
http://r.789695.n4.nabble.com/in-operator-NOT-IN-td3506655.html