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>Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 5There 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ross Ihaka wrote:> 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.An alternative to using "[.ts" to take row subsets would be to expand the window.ts() function to include a "freq" or "deltat" argument. One can then use window() to thin out a regular time series and "[.ts" could be modified to just return a simple array subset (in the process get rid of the horrible warning about not returning a time series). I already did something like this in the coda package for MCMC output - which one often wants to thin out because of high autocorrelation. Martyn -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._