title: Rename Columns with names from another data frame
body: <p>I'm learning R programming as such have hit a few problems - and with your help have been able to fix them. </p>
  
  <p>But I now have a need to rename columns of a data frame. I have a translation data frame with 2 columns that contains the column names and what the new columns should be called. </p>
  
  <p>Here is my code: my question is how do I select the two columns from the <strong>trans</strong> dataframe and use them here as <em>trans$old</em> and <em>trans$new</em> variables?</p>
  
  <p>I have 7 columns I'm renaming, and this might be even longer hence the translation table.</p>
  
  <pre><code>replace_header &lt;- function()
  {      
    names(industries)[names(industries)==trans$old] &lt;- trans$new
    replaced &lt;- industries
    return (replaced)
  }  
  
  replaced_industries &lt;- replace_header()
  </code></pre>