[R] xts POSIXct index format

David Winsemius dwinsemius at comcast.net
Sun Mar 6 06:00:05 CET 2011


On Mar 5, 2011, at 11:28 AM, Joshua Ulrich wrote:

> Hi Chris,
>
> Perhaps something like this?
>
> require(xts)
> ds <- options(digits.secs=6) # so we can see sub-seconds
> x <- xts(1:10, as.POSIXct("2011-01-21") + c(1,1,1,2:8)/1e3)
> x
> indexFormat(x) <- "%H:%M:%OS3"
> x
>

Joshua;

Does your reading of help(indexFormat) lead you to that suggestion?  
When I read it I thought that indexFormat would only accept onoe of "  
Date, POSIXct, chron,yearmon, yearqtr or timeDate." Those were the  
formats mentioned in the immediately preceding paragraph. I went to  
the help page hoping I would be told I could use format strings but  
left it thinking that I could only specify format classes.

-- 
David


> Hope that helps,
> --
> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>
>
>
> On Fri, Mar 4, 2011 at 5:57 PM, rivercode <aquanyc at gmail.com> 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.
>>
>> Think I am missing the obvious.
>>
>> Cheers,
>> Chris
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/xts-POSIXct-index-format-tp3336136p3336136.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list