title: How to remove items in a vector from another vector
body: <p>I have two vectors: </p>
  
  <pre><code>a = c(1,1,2,2,3,3,4,4) 
  b = c(1)
  </code></pre>
  
  <p>I want to remove the <em>first</em> match of <code>b</code> from <code>a</code>. Thus, here only the first <code>1</code> is removed from <code>a</code>:</p>
  
  <pre><code>c = c(1,2,2,3,3,4,4)
  </code></pre>
  
  <p>The order of items in <code>a</code> is not important.</p>
  
  <p>I tried this code:</p>
  
  <pre><code>a[a != b]
  a[! a %in% b] 
  </code></pre>
  
  <p>Both results are:</p>
  
  <pre><code>[1] 2 2 3 3 4 4.
  </code></pre>
  
  <p>All numbers of 1 are removed. However, I only want to remove the specific item in <code>b</code> from <code>a</code>. </p>
  
  <p>If <code>b = c(1, 1, 2)</code>, then I wish the result</p>
  
  <pre><code>[1] 2 3 3 4 4
  
  a[-(1:3)]
  </code></pre>
  
  <p>The above code could lead to the result of <code>[1] 2 3 3 4 4</code>. However, I wish it could be more flexible. For example when the order of items are unknown or random:</p>
  
  <pre><code>a = c(3,4,3,1,2,2,1,4)
  </code></pre>
  
  <p>How can I do it using R?</p>