title: Calculate percentages / proportions of values by group using data.table
body: <p>I have a <code>data.table</code> that looks like the following:</p>
  
  <pre><code>x, y, sum(count)
  1, 1, 3
  1, 2, 7
  1, 3, 8
  2, 1, 4
  2, 2, 3
  2, 3, 10
  </code></pre>
  
  <p>And so on. It's keyed by <code>x</code> and <code>y</code> and I did a <code>sum</code> on a <code>count</code> column. I would like to break it down into percentages by the values of x so that it becomes:</p>
  
  <pre><code>x, y, percentage(counts)
  1, 1, 16.7
  1, 2, 38.9
  1, 3, 44.4
  2, 1, 23.5
  2, 2, 17.6
  2, 3, 58.8
  </code></pre>
  
  <p>So that the total percentage per <code>x</code> value totals 100%. I am doing this using the <code>data.table</code> package. Thank you in advance for your help.</p>