From dmurdoch at pair.com  Mon Jun 28 13:41:10 2004
From: dmurdoch at pair.com (dmurdoch@pair.com)
Date: Mon Jun 28 13:41:15 2004
Subject: [Rd] Problem with hasArg and the ... argument (PR#7027)
Message-ID: <20040628114110.A75A4F306@slim.kubism.ku.dk>

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

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

>I've tracked down the problem. Define the simple function:
>
>xory <- function(x, ...) if (hasArg(y)) y else x
>
>then 
>
>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
>itself?

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


[Rd] Problem with hasArg and the ... argument (PR#7027)
dmurdoch@pair.com