[R-SIG-Finance] in xts behavior of to.minutes() and to.period()

Kenneth Spriggs ksspriggs at gmail.com
Wed Jun 24 16:52:09 CEST 2009


Both VI and WMP are derived from the same xts object - they have the
same rows.  When I use to.minutes() on VI it yields 618 rows but for
WMP it yields 614 rows.
(Same thing if I use to.period() but that's not surprising.)  You can
see both the start times and end times are the same...

> nrow(VI); nrow(WMP)
[1] 401600
[1] 401600

> head(VI, 1); tail(VI, 1)
                        LastPrice
2009-06-22 21:41:54.869         0
                        LastPrice
2009-06-23 18:59:59.735     25689

> head(WMP, 1); tail(WMP, 1)
                        BidPrice
2009-06-22 21:41:54.869       NA
                        BidPrice
2009-06-23 18:59:59.735 115.4746

> VI_minute2 <- to.minutes(VI,2)
> WMP_minute2 <- to.minutes(WMP, 2)
> nrow(VI_minute2); nrow(WMP_minute2)
[1] 618
[1] 614

> VI_minute2p <- to.period(VI, period = "minutes", k=2)
> WMP_minute2p <- to.period(WMP, period = "minutes", k=2)
> nrow(VI_minute2p); nrow(WMP_minute2p)
[1] 618
[1] 614



More information about the R-SIG-Finance mailing list