title: Aggregate/sum and N/A values
body: <p>I have a problem with the way aggregate or N/A deals with sums.</p>
  
  <p>I would like the sums per area.code from following table</p>
  
  <pre><code>test &lt;- read.table(text = "
  area.code   A    B   C   D
  1          0  NA 0.00  NA  NA
  2          1 0.0 3.10 9.6 0.0
  3          1 0.0 3.20 6.0 0.0
  4          2 0.0 6.10 5.0 0.0
  5          2 0.0 6.50 8.0 0.0
  6          2 0.0 6.90 4.0 3.1
  7          3 0.0 6.70 3.0 3.2
  8          3 0.0 6.80 3.1 6.1
  9          3 0.0 0.35 3.2 6.5
  10         3 0.0 0.67 6.1 6.9
  11         4 0.0 0.25 6.5 6.7
  12         5 0.0 0.68 6.9 6.8
  13         6 0.0 0.95 6.7 0.0
  14         7 1.2   NA 6.8 0.0
  ")
  </code></pre>
  
  <p>So, seems pretty easy:</p>
  
  <pre><code>aggregate(.~area.code, test, sum)
  
  
  
  area.code A     B    C    D
  1         1 0  6.30 15.6  0.0
  2         2 0 19.50 17.0  3.1
  3         3 0 14.52 15.4 22.7
  4         4 0  0.25  6.5  6.7
  5         5 0  0.68  6.9  6.8
  6         6 0  0.95  6.7  0.0
  </code></pre>
  
  <p>Apparently not so simple, because area code 7 is completely omitted from the aggregate() command. </p>
  
  <p>I would however like the N/As to be completely ignored or computed as zero values, which na= command gives that option?</p>
  
  <p>replacing all N/As with 0 is an option if I just want the sum... but the mean is really problematic then (since it can't differentiate between 0 and N/A anymore)</p>