title: Rename one named column in R
body: <p>I want to update one column of a dataframe, referencing it using its original name, is this possible? For example say I had the table 'data'</p>
  
  <pre><code>a b c  
  1 2 2  
  3 2 3  
  4 1 2
  </code></pre>
  
  <p>and I wanted to update the name of column b to 'd'. I know I could use  </p>
  
  <pre><code>colnames(data)[2] &lt;- 'd'  
  </code></pre>
  
  <p>but can I make the change by specifically referencing b, i.e. something like </p>
  
  <pre><code>colnames(data)['b'] &lt;- 'd'  
  </code></pre>
  
  <p>so that if the column ordering of the dataframe changes the correct column name will still be updated.</p>
  
  <p>Thanks in advance</p>