[Rd] symbols: xlim and ylim cannot be specified (PR#639)
maechler@stat.math.ethz.ch
maechler@stat.math.ethz.ch
Tue, 22 Aug 2000 09:00:12 +0200 (MET DST)
>>>>> "Uwe" == Uwe Ligges <ligges@statistik.uni-dortmund.de> writes:
Uwe> stahel@stat.math.ethz.ch wrote:
>>
>> symbols(iris[,1],iris[,2],rectangles=as.matrix(iris[,3:4]),inches=0.3,
>> ylim=c(1,5))
>> Error in plot.default(NA, NA, type = "n", ylim = ylim, xlim = xlim, xlab = xlab, :
>> formal argument "ylim" matched by multiple actual arguments
>>
>> Since plot is called inside symbols, with specified xlim and ylim,
>> any specification through ,... hurts this call.
yes,
and Uwe's fix cures this problem.
[Uwe, you should have CC'ed R-bugs, not (only) R-devel .. that's why I
copy it again now].
and I have committed it for the release patches (!! i.e. "1.1.1 patched")
>> I am pretty sure that you won't like to hear the suggestion that
>> this error message
>> formal argument "anything" matched by multiple actual arguments
>> should only be a warning.
>> I would find this more convenient since foreseeing these collisions
>> and programming such arguments as explicit arguments of the "top"
>> function is a nuisance when writing functions just for one project.
Maybe this should be discussed a bit:
The error can only be made into a warning when it makes sense to assume
that it is always okay, to take the *LAST* actual argument as the
desired one. This is the case probably whenever "..." comes at the end of the
formal argument list -- which it is in about 95% of cases...
Hmm, what do others think?
>> Ceterum censeo: Thanks for your efforts for developing such a useful
>> environment.
Merci!
Uwe> Suggestion for a fix:
function (x, y, circles, squares, rectangles, stars, thermometers,
boxplots, inches = TRUE, add = FALSE, fg = 1, bg = NA, xlab = "",
ylab = "", xlim = NULL, ylim = NULL, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^
{
## [...] snip ##
if (!add) {
### check, wheter xlim and ylim are already specified:
if(is.null(xlim)) {
xlim <- range(x, na.rm = TRUE)
xlim <- xlim + c(-1, 1) * (0.1 * diff(xlim))
}
if(is.null(ylim)) {
ylim <- range(y, na.rm = TRUE)
ylim <- ylim + c(-1, 1) * (0.1 * diff(ylim))
}
plot(NA, NA, type = "n", ylim = ylim, xlim = xlim, xlab = xlab,
ylab = ylab, ...)
}
.Internal(symbols(x, y, type, data, inches, bg, fg, ...))
}
Uwe> Regards,
Uwe> Uwe Ligges
Martin 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._