title: Pig: Aggregate with specific parameter dynamically
body: <p>I have data some data that I want to plot, but the aggregation parameter is dependent on the user. The data looks like this-</p>
  
  <pre><code>Date Country Browser Count
  ---- ------- ------- -----
  2015-07-11,US,Chrome,18
  2015-07-11,US,Opera Mini,10
  2015-07-11,US,Firefox,21
  2015-07-11,US,IE,11
  2015-07-11,US,Safari,8
  ...
  2015-07-11,UK,Chrome,102
  2015-07-11,UK,IE,45
  2015-07-11,UK,Mobile Safari,47
  2015-07-11,UK,Firefox,40
  ...
  2015-07-11,DE,Android browser,50
  2015-07-11,DE,Chrome,3
  2015-07-11,DE,IE,11
  2015-07-11,DE,Firefox,20
  </code></pre>
  
  <p>The user will tell me what to aggregate by (country or browser), and I want to display the counts. For example, grouped by country (aggregated by browser) it would be - </p>
  
  <pre><code>2015-07-11,US,ALL,68
  2015-07-11,UK,ALL,234
  2015-07-11,DE,ALL,84
  </code></pre>
  
  <p>whereas grouped by browser (aggregated by country) might be - </p>
  
  <pre><code>2015-07-11,ALL,IE,67
  2015-07-11,ALL,Chrome,123
  2015-07-11,ALL,Firefox,81
  </code></pre>
  
  <p>Would I have to write separate scripts based on each column or are there more efficient ways of doing this?</p>