title: R: as.numeric function not returning correct # from data.frame
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>I am importing an excel document using <code>read.xls</code>. I know this command uses <code>read.table</code> and returns everything as "factors". I am unable to upload my data directly telling <code>read.xls</code> which columns are numeric, as all columns have previous categorical data. So I have been extracting my numeric data columns I desire, then wanting to transform them from data.frames to numeric data, however when I use <code>as.numeric</code> I am receiving numbers that do not correspond to the original data.</p>
  
  <p>For example:</p>
  
  <p>These are the first 6 rows of my data.frame called dfA1, which is a 96,1 vector</p>
  
  <pre><code>         [,1]
  [1,] "103316"
  [2,] "130720"
  [3,] "141808"
  [4,] "131864"
  [5,] "148144"
  [6,] "145760"
  </code></pre>
  
  <p>When I perform <code>as.numeric(dfA1)</code> I receive:</p>
  
  <pre><code>[1]  2  18  29  19  43  40
  </code></pre>
  
  <p>I have absolutely no idea why I get these numbers or how it could be coming up with them. I checked my original xls document and they are marked as numeric with no decimals.</p>