title: Converting a factor to numeric without losing information R (as.numeric() doesn't seem to work)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3418128/r-how-to-convert-a-factor-to-an-integer-numeric-in-r-without-a-loss-of-informat">R - How to convert a factor to an integer\numeric in R without a loss of information</a>  </p>
  </blockquote>
  
  
  
  <p>The following fact about the as.numeric() function has been brought to my attention</p>
  
  <pre><code>&gt; blah&lt;-c("4","8","10","15")
  &gt; blah
  [1] "4"  "8"  "10" "15"
  &gt; blah.new&lt;-as.factor(blah)
  &gt; blah.new
  [1] 4  8  10 15
  Levels: 10 15 4 8
  &gt; blah.new1&lt;-as.numeric(blah.new)
  &gt; blah.new1
  [1] 3 4 1 2
  </code></pre>
  
  <p>When I convert a factor with levels 4, 8, 10, and 15 to a quantitative variable using as.numeric(), every number is converted to a ranking, and the original values are lost. </p>
  
  <p>How do I take the vector 'blah.new' that has levels 10,15, 4, and 8, and convert it to the numeric values 10, 15, 4, and 8? </p>
  
  <p>(This issue has arisen because of a dataset where a quantitative variable is read by read.table() to be a factor)</p>
  
  <p>Thank you!!!!</p>
  
  <p>*****Update: FIGURED IT OUT******</p>
  
  <pre><code>blah.new1&lt;-as.numeric(as.character(blah.new))
  </code></pre>
  
  <p>However, I am wondering where in documentation for as.numeric() does it say that this function converts arguments into a list of rankings? </p>