title: Finding out what values didn't merge in R
body: <p>If I had two simple dataframes:</p>
  
  <pre><code>a &lt;- 1:10
  b &lt;- c("a","b","c","d","e","f","g","h","i","j")
  df1 &lt;-data.frame(a,b)
  
  c &lt;- 1:7
  d &lt;- c("k","l","m","n","o","p","q")
  df2 &lt;-data.frame(c,d)
  </code></pre>
  
  <p>... and I wanted to merge them by "a" and "c" for df1 and df2 respectively using:</p>
  
  <pre><code>df3= merge(df1, df2, by.x = "a", by.y = "c")
  </code></pre>
  
  <p>How would I go about producing a dataframe of rows in df1 which didn't merge?  For example:</p>
  
  <pre><code>    a b
  8   8 h
  9   9 i
  10 10 j
  </code></pre>
  
  <p>Any help would be gratefully received.</p>
  
  <p>EDIT
  Using the suggestion in the comment, I can do:</p>
  
  <pre><code>check = setdiff(df1$a, df2$c)
  </code></pre>
  
  <p>This is great, as I get 8:10 which is correct, but I do need the other column in df1 listed to...  Can this be done with setdiff too?</p>