[R] R: ts - objects (PR#228)

p.dalgaard@biostat.ku.dk p.dalgaard@biostat.ku.dk
Thu, 15 Jul 1999 13:53:54 +0200 (MET DST)


Marcus Eger <marcus.eger@physik.uni-marburg.de> writes:

> > time(sqrt(arrts))
> Time Series:
> Start = c(1, 1) 
> End = c(5, 1) 
> Frequency = 1 
> [1] 1 2 3 4 5

Looks like a bug...

> ----------------------------------------------------------------------------
> 2. (At least) boolean indexing with matrices does not seem to work
> properly:
> ----------------------------------------------------------------------------
> > arrts[is.finite(arrts)]
> Error: subscript (10) out of bounds, should be at most 5
> > 
> > unclass(arrts)[is.finite(arrts)]
>  [1]  1  2  3  4  5  6  7  8  9 10

Yes, we discussed that a short while ago on R-devel. It's trying too
hard to retain the ts attributes in these cases.

> 
> ----------------------------------------------------------------------------
> This problem arose when I tried to plot my time series: > plot(arrts)
> It was easy to fix in plot.ts:
> ----------------------------------------------------------------------------
> ....
>   if (is.null(ylim)) 
>     ylim <- range(unclass(x)[is.finite(x)])  #by ME, 14-07-99
> #    ylim <- range(x[is.finite(x)])
>   plot.new()
> ....

...although range(x,finite=T) is probably a better fix.

> 
> -----------------------------------------------------------------------------
> 3. Another problem had to do with the value of delta and/or start:
> -----------------------------------------------------------------------------
> > time(ts(c(1,2,3,4),start=3,delta=1.5))
> Error: invalid start

or just: 

> ts(c(1,2,3,4),start=3,delta=1.5)
Time Series:
Start = c(3, 1) 
End = c(7, 1) 
Frequency = 0.666666666666667 
Error: invalid start

..which is pretty darn weird! CC'ed to R-bugs.

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