title: Change column name by looking up
body: <p>I know that I can change a data.frame column name by:</p>
  
  <pre><code>colnames(df)[3] &lt;- "newname"
  </code></pre>
  
  <p>But there might be cases where the column I want to change is not in the 3rd position. Is there a way to look up the column by name and change it? Like this...</p>
  
  <pre><code>colnames(df)[,"oldname"] &lt;- "newname"
  </code></pre>
  
  <p>BTW, I have tried this code and I keep getting <code>incorrect number of subscripts on matrix</code>.</p>
  
  <p>Thanks.</p>