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

From: Andy Bunn <abunn_at_whrc.org>
Date: Sun 05 Jun 2005 - 04:07:36 EST


Adam:
> Providing a reproducible example would be a first step...

That's the problem, I can't. But I str has come to the rescue:

R > str(rw)
 Time-Series [1:307] from 1690 to 1996: 0.986 1.347 1.502 1.594 1.475 ... R > str(pg)
List of 264

 $ : num 0.227
 $ : num 0.189
 $ : num 0.237
 $ : num 0.235

.
.

.
.

Why is pg a list? pg was created by taking a row out of a much larger data.frame:

R > pg <- ts(matrix(monthly.pg[1,-c(1:4)], ncol = 12, byrow = T), start = 1982)
R > class(pg)
[1] "mts" "ts"
R > mode(pg)
[1] "list"

So, changing the mode to numeric, allowed me to intersect the ts:

R > pg <- ts(matrix(as.numeric(monthly.pg[1,-c(1:4)]), ncol = 12, byrow = T), start = 1982)
R > tsp(ts.intersect(rw, pg))
[1] 1982 1996 1

Weird. I suppose keeping on top of every object's mode is important.

Thanks for the push forward.

-Andy



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 Sun Jun 05 04:13:33 2005

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