yet another ts problem

Ross Ihaka
Thu, 13 May 1999 10:20:13 +1200 (NZST)

On Wed, 12 May 1999, Paul Gilbert wrote:

> This looks like a slightly different problem then the other ones:
> R : Copyright 1999, The R Development Core Team
> Version 0.64.1  (May 8, 1999)
> ...
> > z <- ts(matrix(c(1:9,NA), 5, 2), start=c(1991,1))
> > na <-
> > z[na]
> Error: subscript (10) out of bounds, should be at most 5

There seem to be two problems here

1. I think that "[.ts" tries too hard to turn its value back into
   a time series.  The only case where this makes sense is when
   a selection of columns is taken from a multivariate series.
   If a row subset is taken, it can only be a time series if
   the subscripts have a very special pattern.  This would be
   too expensive I think.

   In S there is no "[.ts", and a simple array subset is returned.

2. There is a subscripting problem in 0.65 which is tripped by this
   (Paul's example triggers a coredump in 0.65).  The problem can
   be reproduced simply with:
	x <- 1:5
	i <- matrix(F,nr=5,nc=2)
	i[5,2] <- T

I will look at the latter, but I think the former needs a look too. 


r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: