title: R data frame: How to control the conversion of matrix containing scientific notation strings to numeric
body: <p>I have a string matrix where the fields were derived from numbers in scientific notation. I want to convert the character matrix to a data frame and work on the numeric fields. During the matrix to data frame conversion R converts the strings to factors, maybe because of the 'e' character in the middle of the number. If the stringAsFactors() option is set to FALSE, the columns will be left as character, so still not numeric.</p>
  
  <p>For example:</p>
  
  <pre><code>&gt; m
       [,1]    [,2]   
  [1,] "1e-07" "4e-06"
  [2,] "2e-05" "5e-05"
  [3,] "0.03"  "1e-07"
  &gt; data.frame(m)
       X1    X2
  1 1e-07 4e-06
  2 2e-05 5e-05
  3  0.03 1e-07
  &gt; class(data.frame(m))
  [1] "data.frame"
  &gt; df = data.frame(m) 
  &gt; df
       X1    X2
  1 1e-07 4e-06
  2 2e-05 5e-05
  3  0.03 1e-07
  &gt; class(df$X1)
  [1] "factor"
  &gt; class(df$X2)
  [1] "factor"
  </code></pre>
  
  <p>How can I force the data frame to interpret these strings as numbers? data.matrix() does actually convert string in scientific notation to numeric, but I want to know if there is a way to control the character matrix to data frame conversion directly, without going through the intermediate data.matrix() conversion step.</p>