[R] as.POSIXct show milliseconds with format

rivercode aquanyc at gmail.com
Thu Mar 3 05:04:08 CET 2011


Hi,

Trying to create a POSIXct index for an xts object that will display the
POSIXct index as HH:MM:SS.MMM.

First of all, I am trying to get the as.POSIXct to work with format...

> as.POSIXct(paste("2011-03-02 09:00:00.000", sep=""), tz="EST",
> format="%H:%M:%OS3")
[1] NA

Why is this returning NA ?

I can get Hours and Minutes...but only with the format as %H %M. 

> as.POSIXct(paste("2011-03-02 09:00:00.000", sep=""), tz="EST", format="%H
> %M")
[1] "2011-03-02 20:11:00 EST"

BUT if I do it with format="%H:%M" I also get an NA:
> as.POSIXct(paste("2011-03-02 09:00:00.000", sep=""), tz="EST",
> format="%H:%M")
[1] NA

What am I not understanding ?

Is it possible to create a POSIXct index for xts (or zoo) that will display
(eg. with head(my_xts_object) ) the index in format HH:MM:SS.MMM so I can
see the milliseconds.

Thanks,
Chris




--
View this message in context: http://r.789695.n4.nabble.com/as-POSIXct-show-milliseconds-with-format-tp3332733p3332733.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list