title: R Convert data frame to matrix keeping certain columns as numeric
body: <p>I have the following data fame df:</p>
  
  <pre><code>  author         filename    a   all  also
  1  dispt dispt_fed_49.txt 0.28 0.052 0.009
  2  dispt dispt_fed_50.txt 0.18 0.063 0.013
  3  dispt dispt_fed_51.txt 0.34 0.090 0.008
  4  dispt dispt_fed_52.txt 0.27 0.024 0.016
  5  dispt dispt_fed_53.txt 0.30 0.054 0.027
  </code></pre>
  
  <p>I want to convert to matrix using:</p>
  
  <pre><code>mat &lt;- as.matrix(df)
  </code></pre>
  
  <p>But the result shows numeric columns as text:</p>
  
  <pre><code> author           filename              a       all     also   
   [1,] "dispt"    "dispt_fed_49.txt"    "0.280" "0.052" "0.009"
   [2,] "dispt"    "dispt_fed_50.txt"    "0.177" "0.063" "0.013"
   [3,] "dispt"    "dispt_fed_51.txt"    "0.339" "0.090" "0.008"
   [4,] "dispt"    "dispt_fed_52.txt"    "0.270" "0.024" "0.016"
   [5,] "dispt"    "dispt_fed_53.txt"    "0.303" "0.054" "0.027"
  </code></pre>
  
  <p>How can I keep these as numeric while </p>