title: Apply dplyr functions to several columns of a matrix
body: <p>I have a 38467*59 data frame. Here is a subset of the whole dataset</p>
  
  <pre><code>mydata.2
     Unique.Groups Protein.group.IDs Intensity.R1 Intensity.R2
  1            yes                 0      9701600     17971000
  2            yes                 0            0     29308000
  3            yes                 1     49083000     75300000
  4            yes                 2     53926000     13926000
  5            yes                 3     35255000     35750000
  6            yes                 3    302600000    295410000
  7            yes                 4     72766000     51914000
  8            yes                 5     33657000     31027000
  9            yes                 5     16504000     20689000
  10           yes                 5    191170000    209230000
  11           yes                 5    155710000    150280000
  12           yes                 5    402890000    529300000
  13           yes                 5    633480000    522180000
  14           yes                 5     92339000            0
  15           yes                 6            0     30646000
  16           yes                 6     67494000     92326000
  17           yes                 6     20205000            0
  18           yes                 7     94183000     76848000
  19           yes                 7     15584000            0
  20           yes                 7     27247000     38961000
  21           yes                 7     98433000    390870000
  22           yes                 8            0     36542000
  23           yes                 8     83978000            0
  24           yes                 8     53744000     95173000
  25           yes                 8            0     53494000
  </code></pre>
  
  <p>I applied the following piece of code to Intensity.R1 column and I'd like to apply it automatically to all the Intensities column of the data frame. 
  At each round I need to run the same code on Intensity.R1, Intensity.R2, and so on.</p>
  
  <pre><code>     data.normalized &lt;- filter(mydata.2, Unique.Groups == "yes") %&gt;% 
    group_by(Protein.group.IDs) %&gt;%
    arrange(desc(Intensity.R1)) %&gt;% 
    top_n(3, Intensity.R1) %&gt;%
    mutate(sum.top.3.R1 = sum(Intensity.R1)) %&gt;%
    filter(!duplicated(Protein.group.IDs)) %&gt;%
    drop.levels() %&gt;%
    arrange(Protein.group.IDs)
  </code></pre>
  
  <p>Each round should generate a new column (i.e sum.top.3) that I want to bind together in a final table.
  Here is an example just for the Intensity.R1 column.</p>
  
  <pre><code>data.normalized    
  Source: local data frame [9 x 5]
      Groups: Protein.group.IDs
  
        Unique.Groups Protein.group.IDs Intensity.R1 Intensity.R2 sum.top.3.R1
      1           yes                 0      9701600     17971000      9701600
      2           yes                 1     49083000     75300000     49083000
      3           yes                 2     53926000     13926000     53926000
      4           yes                 3    302600000    295410000    337855000
      5           yes                 4     72766000     51914000     72766000
      6           yes                 5    633480000    522180000   1227540000
      7           yes                 6     67494000     92326000     87699000
      8           yes                 7     98433000    390870000    219863000
      9           yes                 8     83978000            0    137722000
  </code></pre>