title: Replace Values in R - Error Received
body: <p>I have a dataframe, titled <code>gen</code>, which is a data frame made up of A's, C's, G's, T's, and 0's. I would like to replace the A with a 1, the C with a 2, the G with a 3, and the T with a 4. When I try using the code <code>gen1[gen1 == "A"] = 1</code>, I get the error message:</p>
  
  <pre><code>Warning messages:
  1: In `[&lt;-.factor`(`*tmp*`, thisvar, value = "1") :
    invalid factor level, NAs generated
  </code></pre>
  
  <p>The resulting data frame has all of the A's replaced, but there are NA's instead of 1's.</p>
  
  <p>Does anyone know how to do this correctly?</p>
  
  <p>Thanks</p>