title: How to create a subset by using another subset as condition?
body: <p>I want to create a subset using another subset as a condition. I can't show my actual data, but I can show an example that deals with the core of my problem. </p>
  
  <p>For example, I have 10 subjects with 10 observations each. So an example of my data would be to create a simple data frame using this:</p>
  
  <pre><code>    ID &lt;- rep(1:10, each = 10)
      x &lt;- rnorm(100)
      y &lt;- rnorm(100)
      df &lt;- data.frame(ID,x,y)
  </code></pre>
  
  <p>Which creates:</p>
  
  <pre><code>       ID           x           y
     1    1  0.08146318  0.26682668
     2    1 -0.18236757 -1.01868755
     3    1 -0.96322876  0.09565239
     4    1 -0.64841436  0.09202456
     5    1 -1.15244873 -0.38668929
     6    1  0.28748521 -0.80816416
     7    1 -0.64243912  0.69403155
     8    1  0.84882350 -1.48618271
     9    1 -1.56619331 -1.30379070
     10   1 -0.29069417  1.47436411
    11   2 -0.77974847  1.25704185
    12   2 -1.54139896  1.25146126
    13   2 -0.76082748  0.22607239
    14   2 -0.07839719  1.94448322
    15   2 -1.53020374 -2.08779769 
      etc.
  </code></pre>
  
  <p>Some of these subjects were positive for an event (for example subject 3, 5 and 7), so I have created a subset for that using:</p>
  
  <pre><code>    event_pos &lt;- subset(df, ID %in% c("3","5","7"))
  </code></pre>
  
  <p>Now, I also want to create a subset for the subjects who were negative for an event. I could use something like this:</p>
  
  <pre><code>   event_neg &lt;- subset(df, ID %in% c("1","2","4","6","8","9","10"))
  </code></pre>
  
  <p>The problem is, my data set is too large to specify all the individuals of the negative group. Is there a way to use my subset event_pos to get all the subjects with negative events in one subset? </p>
  
  <p>TL;DR</p>
  
  <p>Can I get a subset_2 by removing the subset_1 from the data frame?</p>