title: Complicated table calculations
body: <p>I have a dataframe df_workingFile:</p>
  
  <pre><code>group  | id  | flag | value |
   a     |  a  |  0   |  5    |  
   a     |  c  |  0   |  2    |  
   b     |  b  |  0   |  8    |  
   b     |  e  |  1   |  1    |  
  </code></pre>
  
  <p>I want to <strong>sum</strong> the <em>value</em> column based on group, but only on the row where <em>group</em> = <em>id</em> (there can only be one of these instances by group). I also don't want to include any values in the sum that have a <em>flag</em>:</p>
  
  <pre><code>group  | id  | flag | value | ValueSum
   a     |  a  |  0   |  5    |   7
   a     |  c  |  0   |  2    |   0
   b     |  b  |  0   |  8    |   8
   b     |  e  |  1   |  1    |   0
  </code></pre>
  
  <p>Input data:</p>
  
  <pre><code>df_workingFile &lt;- structure(list(group = structure(c(1L, 1L, 2L, 2L), .Label = c("a", 
  "b"), class = "factor"), id = structure(c(1L, 3L, 2L, 4L), .Label = c("a", 
  "b", "c", "e"), class = "factor"), flag = c(0, 0, 0, 1), value = c(5, 
  2, 8, 1)), .Names = c("group", "id", "flag", "value"), row.names = c(NA, 
  4L), class = "data.frame")
  </code></pre>