title: How to load txt file as matrix in R?
body: <p>I can load a txt file (which has around 2 million lines) as data frame like this:</p>
  
  <pre><code>&gt; a=read.table("Retina_LCL_overlap_readyTPR.txt", header = TRUE)
  &gt; head(a)
     chr    pos         gene_id       LCL      Retina       wl      wr
  1 chr1 775930 ENSG00000237094 0.3559520 9.72251e-05 31.62278 21.2838
  2 chr1 815963 ENSG00000237094 0.2648080 3.85837e-06 31.62278 21.2838
  3 chr1 816376 ENSG00000237094 0.3313120 3.85824e-06 31.62278 21.2838
  </code></pre>
  
  <p>But I would like to load it as a matrix to speed up some operation I am doing on this data. I tried doing this:</p>
  
  <pre><code>&gt; library(tseries)
  &gt; a=read.matrix("Retina_LCL_overlap_readyTPR.txt", header = TRUE, sep = "", skip = 0)
  Error in scan(file, sep = sep, skip = skip + 1, quiet = TRUE) : 
    scan() expected 'a real', got 'chr1'
  </code></pre>
  
  <p>I would like my data to look like this after I load it into matrix:</p>
  
  <pre><code>          [,1]      [,2]      [,3]     [,4] 
  [1,] 0.3559520 9.72251e-05 31.62278  21.2838  
  [2,] 0.2648080 3.85837e-06 31.62278  21.2838   
  [3,] 0.3313120 3.85824e-06 31.62278  21.2838
  </code></pre>