Martyn Plummer
1997-Dec-11 10:02 UTC
R-alpha: "[.ts" warning "Not returning time series.."
On 11-Dec-97 maechler@stat.math.ethz.ch wrote:>>>>>> "PaulG" == Paul Gilbert <pgilbert@bank-banque-canada.ca> writes: > > PaulG> I have a class "tframe" with more specific classes indicating > PaulG> how time is being represented, such as > > >> class(tframe(data)) > PaulG> [1] "ts" "tframe" > > PaulG> but now "[.ts" produces warning messages > > >> tframe(data)[2] > PaulG> Warning: Not returning a time series object [1] 2006.25 > > PaulG> Even my simplest tests produce hundreds of lines of warnings, so > PaulG> I've commented out the line # warning("Not returning a time > PaulG> series object") in "[.ts". I'm not sure if this is the best > PaulG> solution, but something is necessary. > >I agree that this can be a pain. >On the other hand, I think it can be very helpful to get this warning >when you subscript a time-series and don't get one anymore. > >I think we want > 1) No warning if only one element of a time-series is chosen > (however, even this is debatable: > Think of a function containing code > i <- !is.na(...) && a < b > result.ts <- my.ts[i] > > wouldn't you want to be warned if `result.ts' is not a ts anymore? ) > > 2) A warning otherwise -- which can be turned off --- > I propose to create an option (one of `options()') to handle this. > >Another -- maybe even better -- alternative : >We introduce an argument > drop = TRUE >as for arrays. >Then the warning would only happen in the case drop = FALSE >when it was really impossible to make an (equispaced) ts out of the >subscripted one.Sorry this is my fault. I suggested this code because the previous version of [.ts<- did not allow you to subscript time series at all without unclassing them. The current version at least tries to preserve time series objects. I think what we really need is an irregular time series class like the S-PLUS "its". Then array subscripting can do the right thing, and do it silently. In the absence of such a class in R, I put the warning in. The message could be translated as "fix me", so I'm glad you brought it up. 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._