title: How to copy data.frame and change column names with a single expression?
body: <p>Is there a way to achieve the following with a single expression?:</p>
  
  <pre><code>copy_of_df &lt;- df
  names(copy_of_df) &lt;- c("some", "new", "column", "names", ...)
  </code></pre>
  
  <hr>
  
  <p>For example, starting with <code>df</code> as defined below</p>
  
  <pre><code>&gt; set.seed(0)
  &gt; h &lt;- 5
  &gt; (df &lt;- data.frame(x = 1, y = 1:h, z = sample(LETTERS[1:3], h, replace = T)))
    x y z
  1 1 1 C
  2 1 2 A
  3 1 3 B
  4 1 4 B
  5 1 5 C
  </code></pre>
  
  <p>...I can copy <code>df</code> and rename the <em>copy</em>'s columns, like this:</p>
  
  <pre><code>&gt; copy_of_df &lt;- df
  &gt; names(copy_of_df) &lt;- c("P", "Q", "R")
  &gt; copy_of_df
    P Q R
  1 1 1 C
  2 1 2 A
  3 1 3 B
  4 1 4 B
  5 1 5 C
  </code></pre>
  
  <p>Can the same copy + rename operation be achieved with a single expression?</p>