[R] cbind.ts bug?

ggrothendieck@yifan.net ggrothendieck at yifan.net
Tue Apr 2 07:26:41 CEST 2002


The following creates a time series tt1 whose values rise from 1
to 20 and another time series tt2 each of whose values are 10 larger
than the corresponding value in tt1.  When we attempt to bind them
together as columns, the entry after Dec 1960 is erroneously listed
as NA 1960 instead of Jan 1961.   If n is changed to either 19 or is 
changed to 21 in the  example below, the example suddenly works 
correctly.

> n <- 20
> x <- 1:n
> tt1 <- ts(x,start=c(1960,2),freq=12)
> tt2 <- ts(10+x,start=c(1960,2),freq=12)
> cbind(tt1,tt2)

         tt1 tt2
Feb 1960   1  11
Mar 1960   2  12
Apr 1960   3  13
May 1960   4  14
Jun 1960   5  15
Jul 1960   6  16
Aug 1960   7  17
Sep 1960   8  18
Oct 1960   9  19
Nov 1960  10  20
Dec 1960  11  21
NA 1960   12  22  <-- Note this line !!!
Feb 1961  13  23
Mar 1961  14  24
Apr 1961  15  25
May 1961  16  26
Jun 1961  17  27
Jul 1961  18  28
Aug 1961  19  29
Sep 1961  20  30
> 

P.S. I am using R 1.4.1 on Windows 2000.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list