title: Copy rows where data equals a certain value and repeats n number of times
body: <p>I have a data frame with 15 columns and 75,000 rows. There are approximately 25,000 unique values for column 1. </p>
  
  <p>I want a new data frame copied from this where the value in column 1 appears 365 times and the value in columns 10 and 11 are not equal to -999.</p>
  
  <p>Smaller example:</p>
  
  <pre><code>df &lt;- data.frame(a=c(1,1,1,2,2,2,3,3,4), b=c(4,5,6,4,5,6,4,5,6), c=c(7,8,9,-999,8,9,7,8,9),d=c(2,3,4,2,3,-999,2,3,4))
    a b    c    d
  1 1 4    7    2
  2 1 5    8    3
  3 1 6    9    4
  4 2 4 -999    2
  5 2 5    8    3
  6 2 6    9 -999
  7 3 4    7    2
  8 3 5    8    3
  9 4 6    9    4
  </code></pre>
  
  <p>For example I want the values that show up in column a 3 times (1,2,3) AND don't have -999 in columns c or d.</p>
  
  <pre><code>  a b    c    d
  1 1 4    7    2
  2 1 5    8    3
  3 1 6    9    4
  </code></pre>
  
  <p>I've tried using something like <code>tmp &lt;- table(df[df$c != -999,"a"])</code> but that only gives me the frequency. How can I copy the data out?</p>