Re: [R] Help: problem converting character to numeric

2012-03-14 Thread Gabor Grothendieck
On Wed, Mar 14, 2012 at 6:07 PM, Aurélien PHILIPPOT wrote: > Dear R experts, > I have a dataframe imported from a csv file (with read.csv). > > Here is an example: > > mm<- c("19860228", "19860331","19860430","19860531") > id<-c("1","1","1","1") > re<- c("C","0.25", "0.98", "1.

Re: [R] Help: problem converting character to numeric

2012-03-14 Thread Aurélien PHILIPPOT
thanks for your suggestions, which work. In addition, I updated Rstudio to the latest version and my old code works again. Best, Aurelien 2012/3/14 Petr Savicky > On Wed, Mar 14, 2012 at 03:07:19PM -0700, Aurélien PHILIPPOT wrote: > > Dear R experts, > > I have a dataframe imported from a csv f

Re: [R] Help: problem converting character to numeric

2012-03-14 Thread Petr Savicky
On Wed, Mar 14, 2012 at 03:07:19PM -0700, Aurélien PHILIPPOT wrote: > Dear R experts, > I have a dataframe imported from a csv file (with read.csv). > > Here is an example: > > mm<- c("19860228", "19860331","19860430","19860531") > id<-c("1","1","1","1") > re<- c("C","0.25", "

Re: [R] Help: problem converting character to numeric

2012-03-14 Thread Jorge I Velez
Dear Aurelien, Thanks for the reproducible example. Here is one way: mm<- c("19860228", "19860331","19860430","19860531") id<-c("1","1","1","1") re<- c("C","0.25", "0.98", "1.34") mret <- data.frame(mm, id, re) subset(mret, !is.na(as.numeric(as.character(re HTH, Jorg

[R] Help: problem converting character to numeric

2012-03-14 Thread Aurélien PHILIPPOT
Dear R experts, I have a dataframe imported from a csv file (with read.csv). Here is an example: mm<- c("19860228", "19860331","19860430","19860531") id<-c("1","1","1","1") re<- c("C","0.25", "0.98", "1.34") mret<-data.frame(mm, id, re) mret<-as.numeric(as.character(mret