title: Apply function conditionally
body: <p>I have a dataframe like this:</p>
  
  <pre><code>experiment iter  results
      A       1     30.0
      A       2     23.0
      A       3     33.3
      B       1     313.0
      B       2     323.0
      B       3     350.0
   ....
  </code></pre>
  
  <p>Is there a way to tally results by applying a function with conditions. In the above example, that condition is all iterations of a particular experiment.</p>
  
  <pre><code>A   sum of results (30 + 23, + 33.3)
  B   sum of results (313 + 323 + 350)
  </code></pre>
  
  <p>I am thinking of "apply" function, but can't find a way to get it work.</p>