[R] Problem in Dates

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 19 15:08:19 CET 2006


Read R News 4/1 help desk article and the last line of every message to r-help.
Also putting POSIXlt objects into data frames is asking for trouble.

On 12/19/06, Shubha Karanth <shubhakaranth at gmail.com> wrote:
> Hi Experts,
>
>
>
> I have a problem in Dates.
>
>
>
> I have a zoo object called 'intra'. And the class of index(intra) is
> ("Chron" "Dates" "Time"). I need to put the index of this zoo object into a
> data frame. So I used,
>
>
>
> idat<-data.frame(Datetime=as.POSIXlt(index(intra),"GMT"))
>
>
>
>
>
> But I get the values of 'idat' to be:
>
>
>
> "01joulu2006 09:59:59"
>
> "01joulu2006 10:09:59"
>
> "01joulu2006 10:19:59"
>
> "01joulu2006 10:30:00"
>
> "01joulu2006 10:40:00"
>
> "01joulu2006 10:50:00"
>
>
>
>
>
> But I need the 'idat' format to be:
>
>
>
> 2006-12-01 13:30:00
>
> 2006-12-01 13:40:00
>
> 2006-12-01 13:50:00
>
> 2006-12-01 14:00:00
>
> 2006-12-01 14:10:00
>
> 2006-12-01 14:19:59
>
> 2006-12-01 14:29:59
>
>
>
>
>
> i.e., instead of joulu (The finnish version of December) I need to get in
> the number format. How do I do this? Do I need to change the OS date format?
>
>
>
> Because I read a documentation which says "Unfortunately, the documentation
> of POSIXt objects is Operating system dependent and especially under MS
> Windows several problems appear in the management of time zones and day
> light saving times" (Source: R Documentation, timeDate Class). Thought this
> may help you…
>
>
>
> Thank you,
>
> Shubha.
>
>        [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
>
>



More information about the R-help mailing list