[R] Time alignment of time series

From: Fernando Saldanha <fsaldan1_at_gmail.com>
Date: Tue 26 Apr 2005 - 10:10:56 EST

One thing that has given me trouble is the fact that the time series implementation in the class ts relies on the concept of a "start" to the time series. For example, if I have

ts1 <- ts(c(1,2,3))

dts1 <- diff(ts1)

then dts1 will be a vector c(1,1) but with the attribute start = 2.

Similarly, when one takes lags the "start" is moved around and the underlying vector itself is left untouched.

Now, data frames seem to be able to deal with this. That is, if I do regressions involving these time series objects the data is correctly aligned. However, for some functions, like for example pairs() the data is misaligned. For example, if I call pairs with a series and itself lagged once and twice as the three arguments I only get points in the diagonals. The start attribute is ignored.

Is there a simple way to avoid this problem? That is, is there a way to keep the data aligned by having functions take the start attribute into account?

Thanks for any help.


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Apr 26 10:15:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:26 EST