title: Recoding factor with many levels
body: <p>I need to recode a factor variable with almost 90 levels. It is trait names from database which I then need to pivot to get the dataset for analysis.
  Is there a way to do it automatically without typing each OldName=NewName?</p>
  <p>This is how I do it with dplyr for fewer levels:</p>
  <pre><code>df$TraitName &lt;- recode_factor(df$TraitName, 'Old Name' = &quot;new.name&quot;)
  </code></pre>
  <p>My idea was to use a key dataframe with a column of old names and corresponding new names but I cannot figure out how to feed it to <code>recode</code></p>