try this: > x <- 2009.004 > # get the number of days in the year > days <- unclass(as.POSIXct(paste(floor(x)+1, "-1-1", sep='')) - + as.POSIXct(paste(floor(x), '-1-1', sep=''))) > # now compute the number of seconds from start of year > current <- as.POSIXct(paste(floor(x), '-1-1', sep='')) + days * (x %% 1) * > 86400 > current [1] "2009-01-02 11:02:23 EST" >
On Mon, Jul 27, 2009 at 8:00 AM, Chuse chuse<chus...@gmail.com> wrote: > Dear R collegues, > > I am trying to change a ts time such as 2009.004 to a str or POSIX > class as "2009-01-01". > Is there any function or method to do it?. Thank you beforehand. > > Chuse. > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.