title: Adding prefix or suffix to most data.frame variable names in piped R workflow
body: <p>I want to add a suffix or prefix to most variable names in a data.frame, typically after they've all been transformed in some way and before performing a join.  I don't have a way to do this without breaking up my piping.</p>
  
  <p>For example, with this data:</p>
  
  <pre><code>library(dplyr)
  set.seed(1)
  dat14 &lt;- data.frame(ID = 1:10, speed = runif(10), power = rpois(10, 1),
                      force = rexp(10), class = rep(c("a", "b"),5))
  </code></pre>
  
  <p>I want to get to this result (note variable names):</p>
  
  <pre><code>  class speed_mean_2014 power_mean_2014 force_mean_2014
  1     a       0.5572500             0.8       0.5519802
  2     b       0.2850798             0.6       1.0888116
  </code></pre>
  
  <p>My current approach is:</p>
  
  <pre><code>means14 &lt;- dat14 %&gt;%
    group_by(class) %&gt;%
    select(-ID) %&gt;%
    summarise_each(funs(mean(.)))  
  
  names(means14)[2:length(names(means14))] &lt;- paste0(names(means14)[2:length(names(means14))], "_mean_2014")
  </code></pre>
  
  <p>Is there an alternative to that clunky last line that breaks up my pipes?  I've looked at <code>select()</code> and <code>rename()</code> but don't want to explicitly specify each variable name, as I usually want to rename all <em>except</em> a single variable and might have a much wider data.frame than in this example.</p>
  
  <p>I'm imagining a final piped command that approximates this made-up function:</p>
  
  <pre><code>appendname(cols = 2:n, str = "_mean_2014", placement = "suffix")
  </code></pre>
  
  <p>Which doesn't exist as far as I know.</p>