title: R Not in subset
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7494848/standard-way-to-remove-multiple-elements-from-a-dataframe">Standard way to remove multiple elements from a dataframe</a>  </p>
  </blockquote>
  
  
  
  <p>I know in R that if you are searching for a subset of another group or matching based on id you'd use something like</p>
  
  <pre><code>subset(df1, df1$id %in% idNums1)
  </code></pre>
  
  <p>My question is how to do the opposite or choose items NOT matching a vector of ids.</p>
  
  <p>I tried using <code>!</code> but get the error message</p>
  
  <pre><code>subset(df1, df1$id !%in% idNums1)
  </code></pre>
  
  <p>I think my backup is to do sometime like this:</p>
  
  <pre><code>matches &lt;- subset(df1, df1$id %in% idNums1)
  nonMatches &lt;- df1[(-matches[,1]),]
  </code></pre>
  
  <p>but I'm hoping there's something a bit more efficient.</p>