On Wed, Mar 14, 2012 at 6:07 PM, Aurélien PHILIPPOT <aurelien.philip...@gmail.com> wrote: > Dear R experts, > I have a dataframe imported from a csv file (with read.csv). > > Here is an example: > > yyyymm<- c("19860228", "19860331","19860430","19860531") > id<-c("10000","10000","10000","10000") > re<- c("C","0.25", "0.98", "1.34") > > mret<-data.frame(yyyymm, id, re) > > mret<-as.numeric(as.character(mret$re)) > Error: (converted from warning) NAs introduced by coercion >
Check the value of the warn option: > getOption("warn") [1] 0 > as.numeric("C") # ok just gives warning [1] NA Warning message: NAs introduced by coercion > options(warn = 2) > as.numeric("C") # now its an error Error: (converted from warning) NAs introduced by coercion -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.