title: Using a loop to rename column names
body: <p>I'm using <code>rename</code> from the <code>dplyr</code> library in R to rename column names. I tried to use a loop to achieve this, which runs without error. However, no column names are updated. The loop is:</p>
  <pre><code>for (i in 1:length(columns)) {
    newcol &lt;- columns[i]
    oldcol &lt;- names(census)[i]
    rename(census, newcol = oldcol) 
  }
  </code></pre>
  <p>The 'columns' variable is a vector containing the new column names (of the same length as the old column names), and 'census' is the tibble containing the data with old column names. When just printing 'newcol' and 'oldcol' for each loop iteration, the names are correct - they just don't seem to then be renamed using the 'rename' line.</p>