title: R equivalent to SAS's "In" data set option for including and excluding overlapping data
body: <p>I'm usually a SAS user but was wondering if there was a similar way in R to list data that can only be found in one data frame after merging them. In SAS I would have used </p>
  
  <pre><code>data want;
      merge have1 (In=in1) have2 (IN=in2) ;
      if not in2;
  run;
  </code></pre>
  
  <p>to find the entries only in have1.
  My R code is: </p>
  
  <pre><code>inner &lt;- merge(have1, have2, by= "Date", all.x = TRUE, sort = TRUE)
  </code></pre>
  
  <p>I've tried setdiff() and antijoin() but neither seem to give me what I want. Additionally, I would like to find a way to do the converse of this. I would like to find the entries in have1 and have2 that have the same "Date" entry and then keep the remaining variables in the 2 data frames. For example, consider have1 with columns "Date", "ShotHeight", "ShotDistance" and have2 with columns "Date", "ThrowHeight", "ThrowDistance" so that the m]new dataframe, call it "new" has columns "Date", ShotHeight", "ShotDistance", "ThrowHeight", "ThrowDistance".</p>