How can I subset rows in a data frame in R based on a vector of values?
I have two data sets that are supposed to be the same size but aren't. I need to trim the values from A that are not in B and vice versa in order to eliminate noise from a graph that's going into a report. (Don't worry, this data isn't being permanently deleted!) I have read the following: Selecting columns in R data frame based on those *not* in a vector http://www.ats.ucla.edu/stat/r/faq/subset_R.htm How to combine multiple conditions to subset a data-frame using "OR"? But I'm still not able to get this to work right. Here's my code: bg2011missingFromBeg <- setdiff(x=eg2011$ID, y=bg2011$ID)