title: Applying group_by and summarise(sum) but keep columns with non-relevant conflicting data?
body: <p>My question is very similar to <a href="https://stackoverflow.com/questions/30024437/applying-group-by-and-summarise-on-data-while-keeping-all-the-columns-info">Applying group_by and summarise on data while keeping all the columns&#39; info</a>
  but I would like to keep columns which get excluded because they conflict after grouping.</p>
  
  <pre><code>Label &lt;- c("203c","203c","204a","204a","204a","204a","204a","204a","204a","204a")
  Type &lt;- c("wholefish","flesh","flesh","fleshdelip","formula","formuladelip",
            "formula","formuladelip","wholefish", "wholefishdelip")
  Proportion &lt;- c(1,1,0.67714,0.67714,0.32285,0.32285,0.32285, 
                  0.32285, 0.67714,0.67714)
  N &lt;- (1:10)
  C &lt;- (1:10)
  Code &lt;- c("c","a","a","b","a","b","c","d","c","d")
  
  df &lt;- data.frame(Label,Type, Proportion, N, C, Code)
  df
  
     Label           Type Proportion  N  C Code
  1   203c      wholefish     1.0000  1  1    c
  2   203c          flesh     1.0000  2  2    a
  3   204a          flesh     0.6771  3  3    a
  4   204a     fleshdelip     0.6771  4  4    b
  5   204a        formula     0.3228  5  5    a
  6   204a   formuladelip     0.3228  6  6    b
  7   204a        formula     0.3228  7  7    c
  8   204a   formuladelip     0.3228  8  8    d
  9   204a      wholefish     0.6771  9  9    c
  10  204a wholefishdelip     0.6771 10 10    d
  
  total &lt;- df %&gt;% 
    #where the Label and Code are the same the Proportion, N and C 
    #should be added together respectively
    group_by(Label, Code) %&gt;% 
    #total proportion should add up to 1 
    #my way of checking that the correct task has been completed
    summarise_if(is.numeric, sum)
  
  # A tibble: 6 x 5
  # Groups:   Label [?]
     Label   Code Proportion     N     C
    &lt;fctr&gt; &lt;fctr&gt;      &lt;dbl&gt; &lt;int&gt; &lt;int&gt;
  1   203c      a    1.00000     2     2
  2   203c      c    1.00000     1     1
  3   204a      a    0.99999     8     8
  4   204a      b    0.99999    10    10
  5   204a      c    0.99999    16    16
  6   204a      d    0.99999    18    18
  </code></pre>
  
  <p>Up until here I get what I want. Now I would like to include the column Type though it is excluded because values are conflicting. this is the result I would like to obtain</p>
  
  <pre><code># A tibble: 6 x 5
  # Groups:   Label [?]
     Label   Code Proportion     N     C    Type
    &lt;fctr&gt; &lt;fctr&gt;      &lt;dbl&gt; &lt;int&gt; &lt;int&gt;  &lt;fctr&gt;
  1   203c      a    1.00000     2     2    wholefish
  2   203c      c    1.00000     1     1    flesh
  3   204a      a    0.99999     8     8    flesh_formula
  4   204a      b    0.99999    10    10    fleshdelip_formuladelip
  5   204a      c    0.99999    16    16    wholefish_formula
  6   204a      d    0.99999    18    18    wholefishdelip_formuladelip
  </code></pre>
  
  <p>I have tried <code>ungroup()</code> and some variations of <code>mutate</code> and <code>unite</code> but to no avail, any suggestions would be greatly appreciated</p>