another multivariate ts bug

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
11 May 1999 23:05:11 +0200


Paul Gilbert <pgilbert@bank-banque-canada.ca> writes:

> I think this is another one of the same kind of bugs in ts:
> 
> Version 0.64.1  (May 8, 1999)
> ...
> >  z <- ts(matrix(1:20,10,2), start=c(1969,1), frequency=12)
> > (z > 5) | (z < 2)
> Error: invalid time series parameters specified
> >

Sigh.

Found and fixed. Same problem. This time in src/main/logic.c, lbinary
function. Here's the patch (cut+paste'd, watch out for whitespace
problems).

RCS file: /users/rdev/R/CVS-ARCHIVE/R/src/main/logic.c,v
retrieving revision 1.8
diff -c -r1.8 logic.c
*** logic.c     1999/03/05 19:19:04     1.8
--- logic.c     1999/05/11 21:02:09
***************
*** 110,121 ****
      y = CADR(args) = coerceVector(y, LGLSXP);
      PROTECT(x = binaryLogic(PRIMVAL(op), x, y));
  
-     if (xts || yts) {
-       setAttrib(x, R_TspSymbol, tsp);
-       setAttrib(x, R_ClassSymbol, class);
-       UNPROTECT(2);
-     }
- 
      if (dims != R_NilValue) {
        setAttrib(x, R_DimSymbol, dims);
        if(xnames != R_NilValue)
--- 110,115 ----
***************
*** 128,133 ****
--- 122,133 ----
            setAttrib(x, R_NamesSymbol, xnames);
        else if(length(x) == length(ynames))
            setAttrib(x, R_NamesSymbol, ynames);
+     }
+ 
+     if (xts || yts) {
+       setAttrib(x, R_TspSymbol, tsp);
+       setAttrib(x, R_ClassSymbol, class);
+       UNPROTECT(2);
      }
      UNPROTECT(4);
      return x;


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._