On Mar 4, 2011, at 6:57 PM, rivercode wrote:

Hi,

I cannot figure out how to change the index format when displaying POSIXct
objects.

Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts
object.

If you are not satisfied with the default format, you have (at least) two options:
a) specify a format when you call print
b) redefine the default.

The default is determined within the print.xts function by a call to indexFormat

> indexFormat
function (x)
{
    attr(x, ".indexFORMAT")
}
<environment: namespace:xts>

So it looks as though you would need to either replace indexFormat or change the attribute of your xts objects. Read further at:

?indexFormat


Think I am missing the obvious.

If you mean looking at the source code, then perhaps you were missing the obvious, or at least merely readily accessible. I don't actually see the option of including a format string in the attribute, so modifying the function may be needed.

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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.

Reply via email to