title: R Programming - Sum Elements of Rows with Common Values
body: <p>Hello and thank you in advance for your assistance,</p>
  
  <p>(PLEASE Note Comments section for additional insight: i.e. the cost column in the example below was added to this question; Simon, provides a great answer, but the cost column itself is not represented in the data response from him, although the function he provides works with the cost column)</p>
  
  <p>I have a data set, lets call it 'data' which looks like this</p>
  
  <pre><code>NAME     DATE     COLOR   PAID    COST
  Jim      1/1/2013 GREEN   150     100
  Jim      1/2/2013 GREEN   50      25
  Joe      1/1/2013 GREEN   200     150
  Joe      1/2/2013 GREEN   25      10
  </code></pre>
  
  <p>What I would like to do is sum the PAID (and COST) elements of the records with the same NAME value and reduce the number of rows (as in this example) to 2, such that my new data frame looks like this:</p>
  
  <pre><code>NAME     DATE     COLOR   PAID    COST
  Jim      1/2/2013 GREEN   200     125
  Joe      1/2/2013 GREEN   225     160
  </code></pre>
  
  <p>As far as the dates are concerned, I don't really care about which one survives the summation process.</p>
  
  <p>I've gotten as far as rowSums(data), but I'm not exactly certain how to use it.  Any help would be greatly appreciated.</p>