title: How to create a new factor based on a current factor?
body: <p>In <code>R</code>, I am trying to do is create a factor by "grouping" values in another factor or character string.</p>
  
  <pre><code>    factor1 &lt;- as.factor(c("A","B","C","D"))
  </code></pre>
  
  <p>what I would like is to create a <code>factor2</code> such that <code>A</code> &amp; <code>B</code> are <code>E</code> and <code>C</code> &amp; <code>D</code> are <code>F</code>.  I've tried looping and can't get that to work but believe there has to be an elegant <code>R</code> way to do this.</p>