title: Remove first occurrence of elements in a vector from another vector
body: <p>I have a character vector, including some elements that are duplicates e.g.</p>
  
  <pre><code>v &lt;- c("d09", "d11", "d13", "d01", "d02", "d10", "d13")
  </code></pre>
  
  <p>And another vector that includes single counts of those characters e.g.</p>
  
  <pre><code>x &lt;- c("d10", "d11", "d13")
  </code></pre>
  
  <p>I want to remove only the <em>first</em> occurrence of each element in <code>x</code> from the 2nd vector <code>v</code>. In this example, <code>d13</code> occurs in <code>x</code> and twice in <code>v</code>, but only the first match is removed from <code>v</code> and the duplicate is kept. Thus, I want to end up with:</p>
  
  <pre><code>"d09", "d01", "d02", "d13"
  </code></pre>
  
  <p>I've been trying various things e.g. <code>z &lt;- v[!(v %in% x)]</code>  but it keeps removing <em>all</em> instances of the characters in <code>x</code>, not just the first, so I end up with this instead:</p>
  
  <pre><code>"d09", "d01", "d02"
  </code></pre>
  
  <p>What can I do to only remove one instance of a duplicated element?</p>