From Martin Maechler <maechler@stat.math.ethz.ch>  Sat Jan 25 17:08:58 2003
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Sat Jan 25 17:08:58 2003
Subject: [Rd] hist() with option "sub" (PR#2492)
In-Reply-To: <200301251115.MAA19304@pubhealth.ku.dk>
References: <200301251115.MAA19304@pubhealth.ku.dk>
Message-ID: <15922.46299.332945.769765@gargle.gargle.HOWL>

>>>>> "UweL" == Uwe Ligges <ligges@statistik.uni-dortmund.de>
>>>>>     on Sat, 25 Jan 2003 12:15:52 +0100 (MET) writes:

    UweL> jerome@hivnet.ubc.ca wrote:
    >> 
    >> Full_Name: Jerome Asselin
    >> Version: 1.6.2
    >> OS: redhat linux 7.2
    >> Submission from: (NULL) (142.103.173.179)
    >> 
    >> This is certainly not a big problem, but should there really
    >> be a warning message when I run this?
    >> 
    >> > x <- c(1,1,2,2,2,2,3,3)
    >> > hist(x,sub="Sub Title")
    >> Warning messages:
    >> 1: parameter "sub" couldn't be set in high-level plot() function
    >> 2: parameter "sub" couldn't be set in high-level plot() function
    >> 
    >> The sub title DOES show on the graph. I believe the warning
    >> message is generated by axis() which does not deal with the
    >> parameter "sub".
    >> 
    >> The hist() help file says:
    >> ...: further graphical parameters to `title' and `axis'.
    >> 
    >> I am aware of the challenges of dealing with dots (...) in
    >> functions. Perhaps just a note in the help file about this
    >> would be the best way to keep the code simple.
    >> 
    >> Regards,
    >> Jerome
    >> 

    UweL> This is very common. You will see similar warnings (Note: warnings, not
    UweL> errors!)  for many high-level plot functions with many graphical
    UweL> arguments. It would be a bad idea to mention that on almost every
    UweL> high-level plot funtion's help page, I think. Nevertheless, it might be
    UweL> worth to mention it in the FAQs (Kurt ?), because we see questions
    UweL> (rather than bug reports without apparent reason) on R-help quite
    UweL> regularly (about once a month, I guess).

    UweL> BTW: Martin Maechler addressed the underlying "problem" in his R-devel
    UweL> message:

    UweL> Subject: [Rd] Changing "..." inside a function: impossible? desirable?
    UweL> Date: Tue, 17 Dec 2002 19:07:08

    UweL> where "problem" means that it is impossible (at least not easily with a
    UweL> reasonable amount of code) to write code using "..." that avoids the
    UweL> warning messages.


Thank you, Uwe.
As you know, Luke Tierney has remarked in that same thread that often the
problem can be solved by introducing an explicit argument (and
you know well that one can end up with two many arguments ! :-).

However, `sub' would really be a natural argument -- less for hist() than
for plot.histogram(), the plotting method called  by hist() when
it's plot argument is TRUE.  
Adding it there and pass it explictly to axis() solves this problem.
--> for "R-devel"


Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><



[Rd] hist() with option "sub" (PR#2492)
Martin Maechler