title: Convert character string into numeric values in R
body: <p>I'm reading an .csv excel file in R and extracting the 5th column of my data. I get a character string back, but I need to convert the character string bmi2014 into numeric values without losing the information. This is what I have tried so far:   </p>
  
  <pre><code>options(stringsAsFactors = FALSE)
  setwd("~/CAD Project")
  bmi &lt;- read.csv("~/CAD Project/BMI sex and province.csv")
  bmi &lt;- bmi[8:46 , ] #removing rows I don't need
  bmi &lt;- bmi[, 2:6] #removing columns I don't need
  bmi2014 &lt;- bmi[, 5]
  bmi2014
  [1] "272,818"   "146,959"   "125,859"   "65,238"    "32,132"    "33,106"        
  "443,317"   "234,307" "209,010"   "355,959"   "192,160"   "163,799"      
  "3,226,705" "1,865,444" "1,361,261" "5,508,224" "3,133,853" "2,374,371"  
  "533,910"   "296,162"   "237,748"   "446,312"   "254,005"   "192,307"  
  [25] "1,658,172" "984,981"   "673,190"   "1,667,339" "990,920"   "676,418"        
  "15,453"    "8,482" "6,971"     "19,607"    "11,312"    "8,294"     "9,469"           
  "5,187"     "4,282"     
  mydata &lt;- as.numeric(as.character(bmi2014))
  Warning message:
  NAs introduced by coercion 
  </code></pre>
  
  <p>I've tried using type.convert and </p>
  
  <pre><code> as.matrix(sapply(bmi2014, as.numeric), na.rm = TRUE) 
  </code></pre>
  
  <p>as well but can't seem to solve this problem as NA values are returned. What else can I try so that I have the list of numbers 272,818, 146,959, etc... Thanks!</p>