Re: [R] ts.intersect a multivariate and univariate ts

From: Achim Zeileis <Achim.Zeileis_at_wu-wien.ac.at>
Date: Sat 04 Jun 2005 - 10:52:38 EST

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



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 Sat Jun 04 10:57:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:22 EST