[R] How to use "lag"?
Dirk Eddelbuettel
edd at debian.org
Sat Mar 5 18:14:50 CET 2005
Spencer,
You may want to peruse the list archive for posts that match 'ts' and are
written by Brian Ripley -- these issues have come up before.
The ts class is designed for arima and friends (like Kalman filtering), and
very useful in that context, but possibly not so much anywhere else. lag()
only shifts the _reference dates_ attached to the object. So in a data.frame
context (as for lm()) .... nothing happens.
Personally, I use its as my main container for daily or weekly data. There is
also zoo, which I have meant to examine more closely for a while now. You
want want to use one of those for shifting, matching, intersecting, ... and
then use one of the exporter functions (core() for its) to pass to lm(), say.
Hope this helps, Dirk
--
Better to have an approximate answer to the right question than a precise
answer to the wrong question. -- John Tukey as quoted by John Chambers
More information about the R-help
mailing list