title: data.table sum and subset
body: <p>I have a data.table that I am wanting to aggregate</p>
  
  <pre><code>library(data.table)
  dt1 &lt;- data.table(year=c("2001","2001","2001","2002","2002","2002","2002"),
                    group=c("a","a","b","a","a","b","b"), 
                    amt=c(20,40,20,35,30,28,19))
  </code></pre>
  
  <p>I am wanting to <code>sum</code> the amt by year and group and then filter where the summed amt for any given group is greater than 100.</p>
  
  <p>I've got the data.table sum nailed.</p>
  
  <pre><code>dt1[, sum(amt),by=list(year,group)]
  
     year group V1
  1: 2001     a 60
  2: 2001     b 20
  3: 2002     a 65
  4: 2002     b 47
  </code></pre>
  
  <p>I am having trouble with my final level of filtering.</p>
  
  <p>The end outcome I am looking for is:</p>
  
  <pre><code>   year group V1
  1: 2001     a 60
  2: 2002     a 65
  </code></pre>
  
  <p>As <code>a) 60 + 65 &gt; 100</code> whereas <code>b) 20 + 47 &lt;= 100</code></p>
  
  <p>Any thoughts on how to achieve this would be great.</p>
  
  <p>I had a look at this <a href="https://stackoverflow.com/questions/29211800/data-table-sum-by-group-and-return-row-with-max-value">data.table sum by group and return row with max value</a> and was wondering whether or not their is an equally eloquent solution to my problem.</p>