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

j.j.goeman at lumc.nl j.j.goeman at lumc.nl
Mon Jun 28 11:12:28 CEST 2004


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


Hi Everyone,

I get very strange results using the function hasArg with the ... function
argument. In my own function: 

> gt <- globaltest(X,Y)
> sampling(gt)

works fine, but

> sampling(globaltest(X,Y))

results in:

Error in eval(expr, envir, enclos) : "missing" illegal use of missing

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?

Jelle



More information about the R-devel mailing list