title: Using dplyr in order to create a new column
body: <p>Hel lo
  I have a df such as </p>
  
  <pre><code>Groups COL1 COL2
  G1 1 A
  G1 1 C
  G1 2 A
  G1 2 B
  G1 5 C
  G1 6 C
  G2 7 B
  G2 7 B
  G2 8 C
  G3 10 C
  G3 10 A
  G3 11 B
  G4 12 C
  G4 12 C
  </code></pre>
  
  <p>and the idea is to add a new column <code>COL3</code>
  and </p>
  
  <pre><code>group_by(Groups, COL1) %&gt;%
    mutate(COL3 = COL1(A&gt;B&gt;C))
  </code></pre>
  
  <p>the idea being that within groups and COL1, if two COL2 values are different, if A is present with A or C, all value become A, if A is not present but B is here, all value become B and if there is only C, all value become C (they already are). </p>
  
  <p>so A > B and B > C 
  here is the expected output : </p>
  
  <pre><code>Groups COL1 COL2 COL3
  G1 1 A A
  G1 1 C A 
  G1 2 A A
  G1 2 B A
  G1 5 C C
  G1 6 C C
  G2 7 B B
  G2 7 B B
  G2 8 C C
  G3 10 C A
  G3 10 A A
  G3 11 B B
  G4 12 C C
  G4 12 C C
  </code></pre>
  
  <p>Does someone have an idea ? </p>