title: Mutate multiple / consecutive columns (with dplyr or base R)
body: <p>I'm trying to create &quot;waves&quot; of variables that represent repeated measures.  Specifically, I'm trying to create consecutive variables that represent the mean values for variables 1 - 10, 11 - 20 ... 91-100. Note that the &quot;...&quot; symbolizes the variables for waves 3 through 9, as avoiding typing these is my goal!</p>
  <p>Here is an example data frame, <code>df</code>, with 10 rows and 100 columns:</p>
  <pre><code>mat &lt;- matrix(runif(1000, 1, 10), ncol = 100)
  df &lt;- data.frame(mat)
  dim(df)
  &gt; 10 100
  </code></pre>
  <p>I've used the <code>dplyr::mutate</code> which works once all the variables are typed, but is time-intensive and prone to mistakes. I have not been able to find a way to do so without resorting to manually typing the names of the columns, as I started doing below (note that &quot;...&quot; symbolizes waves 3 through 9):</p>
  <pre><code>df &lt;- df %&gt;% 
        mutate(wave_1 = (X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10) / 10,
               wave_2 = (X11 + X12 + X13 + X14 + X15 + X16 + X17 + X18 + X19 + X20) / 10,
               ...
               wave_10 = (X91 + X92 + X93 + X94 + X95 + X96 + X97 + X98 + X99 + X100) / 10)
  </code></pre>
  <p>Can you  <code>mutate</code> multiple / consecutive columns with 'dplyr'? Other approaches are also welcome.</p>