title: converting string to numeric in R
body: <p>I have a problem regarding data conversion using R language.</p>
  
  <p>I have two data that being stored in variables named lung.X and lung.y, below are the description of my data.</p>
  
  <pre><code>&gt; str(lung.X)
   chr [1:86, 1:7129] "  170.0" "  104.0" "   53.7" "  119.0" "  105.5" "  130.0" ...
   - attr(*, "dimnames")=List of 2
    ..$ : chr [1:86] "V3" "V4" "V5" "V6" ...
    ..$ : chr [1:7129] "A28102_at" "AB000114_at" "AB000115_at" "AB000220_at" ...
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt; str(lung.y)
   num [1:86] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
  </code></pre>
  
  <p><code>lung.X</code> is a matrix (row: 86 col: 7129) and <code>lung.y</code> is an array of numbers (86 entries) </p>
  
  <p>Do anyone know how to convert above data into the format below?</p>
  
  <pre><code>&gt; str(lung.X)
       num [1:86, 1:7129] 170 104 53.7 119 105.5 130...
  </code></pre>
  
  <p>I thought I should do like this</p>
  
  <pre><code>lung.X &lt;- as.numeric(lung.X)
  </code></pre>
  
  <p>but I got this instead</p>
  
  <pre><code>&gt; str(lung.X)
   num [1:613094] 170 104 53.7 119 105.5 130...
  </code></pre>
  
  <p>The reason of doing this is because I need <code>lung.X</code> to be numerical only.</p>
  
  <p>Thank you.</p>