title: Conditionally applying function using ddply
body: <p>i'm looking to run ddply on a subsest of my data but the below example just returns TRUE or FALSE </p>
  
  <p><code>ddply(demoData, .(name, id, gender == "Male"), summarize, tot = sum(count))</code></p>
  
  <p>and</p>
  
  <p><code>ddply(demoData[demoData$gender == 'Male'], .(name, id, gender), summarize, tot = sum(count))</code></p>
  
  <p>doesn't seem to work either. 
  ultimately i need to sum up "count" for all instances of gender = "Male" by name and id.</p>
  
  <p>data sample as requested</p>
  
  <pre><code>id   name    gender     age      count
  1    apple    Male      13-20      25
  1    apple    Male      21-40      30
  1    apple    Female    13-20      60
  1    apple    Female    21-40      42
  2    banana   Male      13-20      45
  2    banana   Male      21-40      12
  2    banana   Female    13-20      22
  2    banana   Female    21-40      74
  </code></pre>
  
  <p>what i want to return is</p>
  
  <pre><code>1    apple    Male   55
  2    banana   Male   57
  </code></pre>