title: subset dataframe based on outlying counts
body: <p>I have a dataframe that looks like following:</p>
  
  <pre><code>df &lt;- data.frame(Site=rep(paste0('site', 1:5), 50),
             Month=sample(1:12, 50, replace=T),
             Count=(sample(1:1000, 50, replace=T)))
  </code></pre>
  
  <p>I want to remove any sites where the count is always &lt;5% of max monthly count across all sites.</p>
  
  <p>The max monthly counts across all sites are:</p>
  
  <pre><code>library(plyr)
  ddply(df, .(Month), summarise, Max.Count=max(Count))
  </code></pre>
  
  <p>If a count of 1 is assigned to site5, then its counts are always &lt;5% of max monthly counts across all sites. Therefore I would want site5 removed.</p>
  
  <pre><code>df$Count[df$Site=='site5'] &lt;- 1
  </code></pre>
  
  <p>However, after assigning new values to site2, some of its counts are &lt;5% of max monthly counts, while others are >5%. Therefore I would not want site2 removed.</p>
  
  <pre><code>df$Count[df$Site=='site2'] &lt;- ceiling(seq(1, 1000, length.out=20))
  </code></pre>
  
  <p>How can I subset dataframe to remove any sites where counts are always &lt;5% of max monthly count? Let me know if question unclear and I will amend.</p>