There seems to be a problem with partial matching of argument names in boxplot(), in respect of the "horizontal" argument. I don't recall seeing this issue discussed previously. My apologies if I am being redundant. (A scan of CRAN revealed that someone had experienced problems with the "horizontal" argument, but he was spelling it out in full, so that was a different issue.) If I execute > x <- rnorm(100) > tmp <- boxplot(x,plot=FALSE) > bxp(tmp,horiz=TRUE) I get the horizontal boxplot that I wanted. However if I go straight for it, as in > boxplot(x,horiz=TRUE) I get the warning message: parameter "horiz" couldn't be set in high-level plot() function and get a vertical boxplot. I traced the warning down to the parameter "horiz" being passed to the title() function, which naturally didn't like it. I finally figured out that what is happening is that there is a little dodge at the start of boxplot.default() whereby arguments get bundled into a list called ``pars'', which gets passed on to bxp(). It seems that since "horiz" doesn't match "horizontal" EXACTLY, it gets bundled into ``pars'' and hence gets handed on to title() which can't use it and ignored in the body of bxp() where it could be used. Things work OK if one says > boxplot(x,horizontal=TRUE) i.e. spelling out ``horizontal'' in full rather than trying to use ``partial argument matching''. However it seems to me that partial argument matching ***ought*** to work --- i.e. it ought to be possible to make it work --- in such a context. Am I suffering from a misapprehension? cheers, Rolf Turner rolf at math.unb.ca -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, 1 Dec 2002, Rolf Turner wrote:> > There seems to be a problem with partial matching of argument names > in boxplot(), in respect of the "horizontal" argument. I don't > recall seeing this issue discussed previously. My apologies if I am > being redundant. (A scan of CRAN revealed that someone had > experienced problems with the "horizontal" argument, but he was > spelling it out in full, so that was a different issue.) > > If I execute > > > x <- rnorm(100) > > tmp <- boxplot(x,plot=FALSE) > > bxp(tmp,horiz=TRUE) > > I get the horizontal boxplot that I wanted. However if I go > straight for it, as in > > > boxplot(x,horiz=TRUE) > > I get the warning message: > > parameter "horiz" couldn't be set in high-level plot() function > > and get a vertical boxplot. > > I traced the warning down to the parameter "horiz" being passed to > the title() function, which naturally didn't like it. > > I finally figured out that what is happening is that there is a little > dodge at the start of boxplot.default() whereby arguments get bundled > into a list called ``pars'', which gets passed on to bxp(). > It seems that since "horiz" doesn't match "horizontal" EXACTLY, it > gets bundled into ``pars'' and hence gets handed on to title() > which can't use it and ignored in the body of bxp() where it could > be used. > > Things work OK if one says > > > boxplot(x,horizontal=TRUE) > > i.e. spelling out ``horizontal'' in full rather than trying to use > ``partial argument matching''. > > However it seems to me that partial argument matching ***ought*** to > work --- i.e. it ought to be possible to make it work --- in such > a context. Am I suffering from a misapprehension?It is defined *not* to work. The call is boxplot(x, ..., range = 1.5, width = NULL, varwidth = FALSE, notch = FALSE, outline = TRUE, names, boxwex = 0.8, plot = TRUE, border = par("fg"), col = NULL, log = "", pars = NULL, horizontal = FALSE, add = FALSE, at = NULL) and argument after ... are not partially matched. See, e.g. `S Programming' p.40. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
In response to my comment> > However it seems to me that partial argument matching ***ought*** to > > work --- i.e. it ought to be possible to make it work --- in such > > a context. Am I suffering from a misapprehension?Brian Ripley wrote> It is defined *not* to work. The call is > > boxplot(x, ..., range = 1.5, width = NULL, varwidth = FALSE, > notch = FALSE, outline = TRUE, names, boxwex = 0.8, plot = TRUE, > border = par("fg"), col = NULL, log = "", pars = NULL, > horizontal = FALSE, add = FALSE, at = NULL) > > and argument after ... are not partially matched. > > See, e.g. `S Programming' p.40.O.K. That's clear enough now. But ***WHY***? I.e. why structure the arguments of boxplot() in this way? I.e. why put the ... argument before everything but x, so that partial matching cannot be used on the rest of the arguments? cheers, Rolf Turner -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._