You may need to modify this slightly depending on the specifics
of the fraction calculation but try this to get started:
x <- 2009.004
dt <- as.Date(paste(floor(x) + 0:1, 1, 1, sep = "-"))
dt[1] + as.numeric(diff(dt)) * (x %% 1) - 1 # 2009-01-01
On Thu, Jul 23, 2009 at 11:48 AM, Chuse chuse<chuse22 at gmail.com>
wrote:> Dear all,
>
> Ive just started with R and I have question:
> how can you change a time from a ts object .i.e 2009.004 to
"2009-01-01"? Is
> there any function for this? I tried around with as.Date... but it hasnt
> worked.
> Thank you beforehand.
>
> Chuse.
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>