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
ligges@statistik.uni-dortmund.de
2003-Jan-25 15:59 UTC
[Rd] hist() with option "sub" (PR#2492)
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 >This is very common. You will see similar warnings (Note: warnings, not errors!) for many high-level plot functions with many graphical arguments. It would be a bad idea to mention that on almost every high-level plot funtion's help page, I think. Nevertheless, it might be worth to mention it in the FAQs (Kurt ?), because we see questions (rather than bug reports without apparent reason) on R-help quite regularly (about once a month, I guess). BTW: Martin Maechler addressed the underlying "problem" in his R-devel message: Subject: [Rd] Changing "..." inside a function: impossible? desirable? Date: Tue, 17 Dec 2002 19:07:08 where "problem" means that it is impossible (at least not easily with a reasonable amount of code) to write code using "..." that avoids the warning messages. Uwe Ligges
>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> >>>>> on Sat, 25 Jan 2003 17:01:31 +0100 writes:..... MM> However, `sub' would really be a natural argument -- less for hist() than MM> for plot.histogram(), the plotting method called by hist() when MM> it's plot argument is TRUE. MM> Adding it there and pass it explictly to axis() solves this problem. Oops, "thinko": I meant `title()', not `axis()'. Martin