title: Different output between sum and +
body: <p>I'm working on a problem that consists basically on sum all the rows based on their ID and sum some specific variables to get a consolidated dataset to input on another work, but there is an issue with the sum function and I'd appreciate some explanation about this.</p>
  
  <p>Dataset:</p>
  
  <pre><code>teste &lt;- data.frame(ID = c(1, 1, 2, 1, 3, 3, 2),
                      VALUE = c(10, 10, 10, 10, 10, 10, 10),
                      MOD = c(1, 1, 1, 1, 1, 1, 1))
  
    ID VALUE MOD
  1  1    10   1
  2  1    10   1
  3  2    10   1
  4  1    10   1
  5  3    10   1
  6  3    10   1
  7  2    10   1
  </code></pre>
  
  <p>Using + operator:</p>
  
  <pre><code>teste %&gt;%
      group_by(ID) %&gt;%
      summarise_all(sum, na.rm = TRUE) %&gt;%
      mutate(CONS = VALUE + MOD)
  
  # A tibble: 3 x 4
       ID VALUE   MOD  CONS
    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1     1    30     3    33
  2     2    20     2    22
  3     3    20     2    22
  </code></pre>
  
  <p>Using <em>sum</em> function:</p>
  
  <pre><code>teste %&gt;%
      group_by(ID) %&gt;%
      summarise_all(sum, na.rm = TRUE) %&gt;%
      mutate(CONS = sum(VALUE, MOD))
  
  # A tibble: 3 x 4
       ID VALUE   MOD  CONS
    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1     1    30     3    77
  2     2    20     2    77
  3     3    20     2    77
  </code></pre>