In R 2.8.0/Windows:

> lag(1)
[1] 1
attr(,"tsp")
[1] 0 0 1

Though this has the 'tsp' attribute, it is of class "integer", and hence not
a "time-series object" as defined by ? ts: "time-series objects... are
vector [sic] or matrices with class of '"ts"' (and additional attributes)".

? lag further says "Vector or matrix arguments 'x' are coerced to time
series", but

> identical(lag(as.ts(1)),lag(1))
[1] FALSE

I believe this can be fixed by adding class(x)<-"ts" after line 7 of
stats:::lag.default (x <- hasTsp(x)).

Perhaps all other users of hasTsp expect the same behavior? in which case it
would better be fixed there.

          -s

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to