Re: [R] How to use "lag"?

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Sun 06 Mar 2005 - 04:14:50 EST

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

______________________________________________
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 Sun Mar 06 04:22:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST