BTW, zoo is like ts in the application of lag.
In other words, zoo and xts are opposite in this issue.

2012/4/12 jpm miao <miao...@gmail.com>

>  Example:
> Will ts objects be obsolete or modified?
>
> > a                [,1]
> 1983 Q1  2.747365190
> 1983 Q2  2.791594762
> 1983 Q3 -0.009953715
> 1983 Q4 -0.015059485
> 1984 Q1 -1.190061246
> 1984 Q2 -0.553031799
> 1984 Q3  0.686874720
> 1984 Q4  0.953911035> lag(a,4)                [,1]
> 1983 Q1           NA
> 1983 Q2           NA
> 1983 Q3           NA
> 1983 Q4           NA
> 1984 Q1  2.747365190
> 1984 Q2  2.791594762
> 1984 Q3 -0.009953715
> 1984 Q4 -0.015059485> lag(as.ts(a, start=c(1983,1)),4)             Qtr1       
>   Qtr2         Qtr3         Qtr4
> 1982  2.747365190  2.791594762 -0.009953715 -0.015059485
> 1983 -1.190061246 -0.553031799  0.686874720  0.953911035
>
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to