[Rd] Problem with hasArg and the ... argument (PR#7027)

dmurdoch at pair.com dmurdoch at pair.com
Mon Jun 28 13:41:10 CEST 2004

On Mon, 28 Jun 2004 11:12:28 +0200 (CEST), j.j.goeman at lumc.nl wrote:

>Full_Name: Jelle Goeman
>Version: 1.9.0
>OS: mingw32, windows 2000
>Submission from: (NULL) (

>I've tracked down the problem. Define the simple function:
>xory <- function(x, ...) if (hasArg(y)) y else x
>x <- 1:10
>xx <- xory(x)
>plot(x, xx)
>works fine, but
>plot(x, xory(x))
>gives the same error. The problem is that the plot function also has an argument
>y, which somehow interferes with the hasArg function. Is there an alternative to
>hasArg that really checks if an argument y was supplied for the xy function

This is still present in 1.9.1 and r-patched (on Windows).  It appears
to be a bug in or misuse of sys.function: within hasArg,
sys.function(0) returns hasArg as expected, but sys.function(1)
returns plot.  xory() seems to get lost.

Duncan Murdoch

More information about the R-devel mailing list