From Martin Maechler <maechler@stat.math.ethz.ch>  Thu Dec 11 08:49:03 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Thu, 11 Dec 1997 09:49:03 +0100
Subject: R-alpha: "[.ts"  warning "Not returning time series.."
In-Reply-To: <97Dec10.141431est.27328@mailgate.bank-banque-canada.ca> (message
 from Paul Gilbert on Wed, 10 Dec 1997 10:40:32 -0500)
Message-ID: <199712110849.JAA04605@sophie.ethz.ch>

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

------------------------------------------------------------

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) ?

Martin Maechler <maechler@stat.math.ethz.ch>		 <><
Seminar fuer Statistik, SOL G1
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086
http://www.stat.math.ethz.ch/~maechler/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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.."
Martin Maechler