[Rd] symbols: xlim and ylim cannot be specified (PR#639)

Uwe Ligges ligges@statistik.uni-dortmund.de
Mon, 21 Aug 2000 18:17:35 +0200


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.
> 
> 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.
> 
> Ceterum censeo: Thanks for your efforts for developing such a useful
>                 environment.


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, ...))
}

Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._