It seems to mean that it adds a Tsp attribute but it does not change the class to "ts":
> dput(lag(1:3)) structure(1:3, .Tsp = c(0, 2, 1)) Try this: > ts(1:3) - structure(lag(1:3), class = "ts") Time Series: Start = 1 End = 2 Frequency = 1 [1] -1 -1 or > ts(1:3) - lag(ts(1:3)) Time Series: Start = 1 End = 2 Frequency = 1 [1] -1 -1 On Mon, Mar 22, 2010 at 12:15 PM, Downey, Patrick <pdow...@urban.org> wrote: > Can anyone tell me what's going on here? > > x <- matrix(data=c(1,2,3,4,5),ncol=1) > x1 <- lag(x,k=1) > x > x1 > x - x1 > > That's with x specified as a column vector, but the same thing happens when > it's a row vector. > > x <- c(1,2,3,4,5) > x1 <- lag(x,k=1) > x > x1 > x - x1 > > When the documentation says "Vector or matrix arguments x are coerced to > time series." What does that mean? > > Thank you, > Mitch > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.