[R-SIG-Finance] timeSeries:: bizarre rbind behavior with colnames

Nicolas Chapados nicolas.chapados at gmail.com
Wed Sep 23 17:43:14 CEST 2009


Dear list,

Looking at the code for timeSeries::rbind, it appears that it insists
on concatenating the names of the two series it's trying to bind, even
if they match exactly, thereby creating a longer series name.  This is
in sharp contrast to, e.g. rbind.data.frame.  This creates very
badly-behaved column names (i.e. horrendously-long) in the case where
one attempts to construct a timeSeries incrementally.

For example:

> rbind(timeSeries(1.0, timeDate("1996-01-01"), units="Level"), timeSeries(2.0, timeDate("2009-01-01"), units="Level"))
GMT
           Level_Level
1996-01-01           1
2009-01-01           2


Can someone explain the design rationale for choosing to concatenate
the column names in such a manner?  In the short term, I resolved to
incrementally constructing a matrix, and at the very end building a
timeSeries, but I would really prefer to keep timeSeries all along...

Many thanks for any help!
+ Nicolas Chapados



More information about the R-SIG-Finance mailing list