title: Plotting binned data using sum instead of count
body: <p>I've tried to search for an answer, but can't seem to find the right one that does the job for me.</p>
  
  <p>I have a dataset (<code>data</code>) with two variables: people's ages (<code>age</code>) and number of awards (<code>awards</code>)</p>
  
  <p>My objective is to plot the number of awards against age in R. FYI, a person can have multiple awards and people can have the same age.</p>
  
  <p>I tried to plot a histogram and barplot, but the problem with that is that it counts the number of observations instead of summing the number of awards.</p>
  
  <p>A sample dataset:</p>
  
  <pre><code>age &lt;- c(21,22,22,25,30,34,45,26,37,46,49,21)
  awards &lt;- c(0,3,2,1,0,0,1,3,1,1,1,1)
  data &lt;- data.frame(cbind(age,awards))
  </code></pre>
  
  <p>What I'm looking for is a histogram (or barplot) that represents this data.</p>
  
  <p>Ideally, I'd want the ages to be split into age groups. For example,
  20-30, 31-40, 41-50 and then the total number of awards for each group.</p>
  
  <p>The age group would be on the x-axis and the total number of awards for each age group would be on the y-axis.</p>
  
  <p>Thanks! </p>