[R] ts.intersect() not working

Sun, Changyou cs258 at msstate.edu
Sun Nov 1 02:40:19 CET 2015


Hi all,

I am trying to combine a single time series with a multivariate ts using ts.intersect(). However, depending on the month, the function may or may not work. Is this a bug or something I missed? Thank you for the help.

Edwin Sun
=================

> # Example 1: work well
> a2 <- ts(data = c(10, 20), start = c(2009, 1), frequency = 12); a2
     Jan Feb
2009  10  20

> a3 <- ts(data = matrix(data = 4:6, nrow = 1), start = c(2009, 2),
+          frequency = 12); a3
         Series 1 Series 2 Series 3
Feb 2009        4        5        6

> aa <- ts.intersect(a2, a3); aa
         a2 a3.Series 1 a3.Series 2 a3.Series 3
Feb 2009 20           4           5           6


> # Example 2: does not work
> b2 <- ts(data = c(10, 20), start = c(2009, 8), frequency = 12); b2
     Aug Sep
2009  10  20

> b3 <- ts(data = matrix(data = 4:6, nrow = 1), start = c(2009, 9),
+          frequency = 12); b3
         Series 1 Series 2 Series 3
Sep 2009        4        5        6

> bb <- ts.intersect(b2, b3); bb
Warning message:
In .cbind.ts(list(...), .makeNamesTs(...), dframe = dframe, union = FALSE) :
  non-intersecting series
NULL


	[[alternative HTML version deleted]]



More information about the R-help mailing list