[R] cbind.ts bug?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Apr 2 08:51:00 CEST 2002


It's a bug, but in print.ts, so you can safely ignore it,
The output from cbind.ts is correct.

In print.ts

	    t2 <- 1 + round(fr.x*((tm+0.001) %%1))

needs the tolerance I have just added.


On Tue, 2 Apr 2002 ggrothendieck at yifan.net wrote:

>
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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