title: Finding the intersection and differences in data using R
body: <p>I'm interested in getting the intersect between A and B and then find the elements that are in X and not C, and vice versa. I have the following codes: </p>
  
  <pre><code>A &lt;- c("ret", "mu", "ty", "umh")
  B &lt;- c("ret","ty", "sem", "eel")
  C &lt;- c("ty", "uuh", "argh", "wwe")
  X &lt;- intersect(A,B)
  U &lt;- diff(C, X)
  </code></pre>
  
  <p>But I got some errors that I've not been able to understand: </p>
  
  <pre><code>Error in diff.default(C, X) : 
  'lag' and 'differences' must be integers &gt;= 1
  </code></pre>
  
  <p>Can anyone help please?</p>
  
  <p>Thanks</p>