[R] ts.intersect a multivariate and univariate ts
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Sat Jun 4 02:52:38 CEST 2005
Andy:
> I have a mv ts object:
>
> R > tsp(pg)
> [1] 1982 2003 1
> R > dim(pg)
> [1] 22 12
>
> and a univariate ts:
>
> R > tsp(rw)
> [1] 1690 1996 1
>
> Yet, when I try to intersect them:
>
> R > tsp(ts.intersect(rw, pg))
> [1] 1982 2176 1
>
> the process goes awry.
>
> How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13
> univariate time series in it. Any help appreciated.
Providing a reproducible example would be a first step...
For me the following works without any problems:
R> pg <- ts(matrix(rnorm(22 * 12), ncol = 12), start = 1982)
R> rw <- ts(rnorm(307), start = 1690)
R> tsp(pg)
[1] 1982 2003 1
R> dim(pg)
[1] 22 12
R> tsp(rw)
[1] 1690 1996 1
R> rwpg <- ts.intersect(rw, pg)
R> tsp(rwpg)
[1] 1982 1996 1
R> dim(rwpg)
[1] 15 13
Best,
Z
More information about the R-help
mailing list