[R] as.POSIXct show milliseconds with format

From: rivercode <aquanyc_at_gmail.com>
Date: Wed, 02 Mar 2011 20:04:08 -0800 (PST)


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.


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.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Mar 2011 - 08:23:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Mar 2011 - 14:00:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive