Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Sean Zhang
David, Gabor, and Henriuqe, Thanks a lot for help! Another (inelegant) way is to use ts() and then supply the start and end time. this inelegant way works (I guess at least for equally spaced data.) . -Sean On Tue, Sep 22, 2009 at 3:19 PM, David Winsemius wrote: > > On Sep 22, 2009, at 3:03 PM

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 3:03 PM, Sean Zhang wrote: Dear R helpers. I am new to plotting time data using R. wonder how to convert character time info into date in R. I searched over the web but did not find answer. the input character string is something like 03_1993 or 03-1993, so the precisio

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Gabor Grothendieck
Try this: > library(zoo) # as.yearmon > > as.yearmon("03_1993", "%m_%Y") [1] "Mar 1993" > as.Date(as.yearmon("03_1993", "%m_%Y")) [1] "1993-03-01" On Tue, Sep 22, 2009 at 3:03 PM, Sean Zhang wrote: > Dear R helpers. > > I am new to plotting time data using R. > wonder how to convert character ti

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Henrique Dallazuanna
Try this: strptime(paste(1, c("03_1993")),"%d %m_%Y") strptime(paste(1, c("03-1993")),"%d %m_%Y") On Tue, Sep 22, 2009 at 4:03 PM, Sean Zhang wrote: > Dear R helpers. > > I am new to plotting time data using R. > wonder how to convert character time info into date in R. > I searched over the web

[R] how to convert character string with only month and year into date

2009-09-22 Thread Sean Zhang
Dear R helpers. I am new to plotting time data using R. wonder how to convert character time info into date in R. I searched over the web but did not find answer. the input character string is something like 03_1993 or 03-1993, so the precision is at month level. I tried the following but failed