From Kurt.Hornik@ci.tuwien.ac.at  Thu Dec 11 09:05:48 1997
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Thu, 11 Dec 1997 10:05:48 +0100
Subject: R-alpha: "[.ts"  warning "Not returning time series.."
In-Reply-To: <199712110849.JAA04605@sophie.ethz.ch>
References: <97Dec10.141431est.27328@mailgate.bank-banque-canada.ca>
 <199712110849.JAA04605@sophie.ethz.ch>
Message-ID: <199712110905.KAA02711@pc25.none>

>>>>> Martin Maechler writes:

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

This is not MAYBE better, but what we really should do.  It conforms
to the general logic of subscripting as was agreed upon.

> ------------------------------------------------------------

> BTW: does anyone care if I completely drop the  "R-alpha:" string
> 						 --------
>      that is automagically prepended to the subject on R-devel
> 	(unless it's already part of the subject) ?

No, of course not.

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


R-alpha: "[.ts" warning "Not returning time series.."
Kurt Hornik