[R] R: ts - objects

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Jul 15 13:58:59 CEST 1999


Marcus Eger <marcus.eger at 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 at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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