[R-SIG-Finance] zoo-like classes in c++?

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 31 23:09:09 CEST 2007

No, zoo does not use builtin time and date classes.  It does not
know anything about Date, chron, POSIXct, etc.  Its completely
general and only assumes that whatever classes you use are ordered
(that's the O in zoo) and have certain methods defined. See ?zoo for
more information on the methods assumed.

For example, here we are using letters as our time/date class.  The
time/date class in this example is not even numeric:

> library(zoo)
> z <- zoo(11:15, letters[1:5])
> merge(z, lag(z, -1))
   z lag(z, -1)
a 11         NA
b 12         11
c 13         12
d 14         13
e 15         14

(Actually there are a few exceptions to the above for convenience, i.e.
"yearqtr" and "yearmon" classes are provided, as.Date.numeric
is provided and read.zoo understands Date and POSIXct classes
but overall the statement that its perfectly general is correct.)

On 7/31/07, Jordi Molins <jordi.molins.coronado at gmail.com> wrote:
> I usually use zoo for my time series in R. However, sometimes my algorithms
> are very slow. Maybe my code is inefficient, but I need to add several for
> and ifs, which I believe slows down the whole calculation.
> I have been thinking that if I could use the C++ STL for intersections (and
> other operations), in addition to use the fast for and if in c++, the
> calculation could be much faster. My problem is that I do not know any time
> and date class in C++ with the same conventions as in zoo and POSIX. I have
> been googling, and I have found Boost.Date_Time, which apparently does quite
> a lot of what I want.
> Is zoo using some time and date class from C++? If yes, which one? if not,
> which one could I use?
> Thank you.
>        [[alternative HTML version deleted]]
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.

More information about the R-SIG-Finance mailing list