From ihaka@stat.auckland.ac.nz  Wed May 12 23:20:13 1999
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Thu, 13 May 1999 10:20:13 +1200 (NZST)
Subject: yet another ts problem
In-Reply-To: <3739EC4F.840C8F9E@bank-banque-canada.ca>
Message-ID: <Pine.BSF.4.05.9905131005150.525-100000@g.ihaka.slip.auckland.ac.nz>


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 <- is.na(z)
> > 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
	x[i]

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

	Ross

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


yet another ts problem
Ross Ihaka