[R] Convert character Variables to numeric

Arun84441 arun.kumar8 at safexpress.com
Wed Aug 26 10:30:32 CEST 2015


I have imported the csv file having 398800 obs of 30 variables. There is a
variable "TOTALFRT" which is showing as character in R environment. I am
trying to convert it to numeric by using as.numeric function.
Wherein function is converting character to numeric but with an error
message "Warning message:
NAs introduced by coercion", it omitted 388800 entries. Hence I am unable to
perform calculation.

Is there anyway by which I can convert NAs to numeric??

Below is the code I used for conversion :-

Mac<-read.csv("July'15.csv", header = TRUE)
Book=as.character(Mac$TOTALFRT)
V = as.numeric(Book)







--
View this message in context: http://r.789695.n4.nabble.com/Convert-character-Variables-to-numeric-tp4711518.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list