title: Convert character matrix to numeric matrix to avoid NAs introduced by coercion
body: <p>I have a 59 (columns) by 32514 (rows) matrix. Most of the data are <code>character</code>, and the structure of (a subset of) the matrix is as follows:</p>
  
  <pre><code>Event Time  Receipt Time    Device      Logger     Version     Device Vendor    
  2013/09/30  2013/09/30  10.6.10.22   Events Local     0        Microsoft Window
  </code></pre>
  
  <p>I have stored the data in a matrix using R for processing. I am trying to do clustering using Kmeans, but am getting the following error:</p>
  
  <pre><code>Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
  In addition: Warning message:
  In kmeans(Data1, 5, iter.max = 10) : NAs introduced by coercion  
  </code></pre>
  
  <p>As my data are in character format, the error <code>NAs introduced by coercion</code> is generated. I have tried to convert the data to numeric form with the following methods, but am still getting the same error.</p>
  
  <pre><code>Data1 &lt;- as.numeric(as.character(Data))
  
  Data1 &lt;- as.matrix(sapply(Data, as.numeric))  
  
  Data1 &lt;- matrix(as.numeric(unlist(Data)),nrow=nrow(Data)) 
  </code></pre>
  
  <p>I have also tried to convert character into numeric column by column, but all data are converted into <code>NA</code>. </p>
  
  <p>What is the correct method to convert my data to numeric?    </p>