[R] Quasi-bug in boxplot().

Rolf Turner rolf at math.unb.ca
Sun Dec 1 19:19:32 CET 2002


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



More information about the R-help mailing list