Hi,
I've been trying to figure out if there's a way to return the actual names of the arguments passed to a function which uses ellipsis.

There's an example in Vincent Zoonekynd's <[EMAIL PROTECTED]> manual that looks like this:

f <- function (...)
{
l <- list(...) # Put the arguments in a (named) list
for (i in seq(along=l))
{
cat("Argument name:", names(l)[i], "Value:", l[[i]], "
\n")
}
}


I don't know exactly what he thought would happen (or what happens from the command line?) but from the Mac Aqua GUI, names(l) evaluates to NULL, or possibly the 'names' attribute of the first element of the first argument passed to the function, if such exists. And in fact 'l' contains the values of all elements of the arguments to f.

So, is there any way to have the function 'f' "know" what the names are of the arguments passed to it? That is, if I type


> f(foo,bar)

I would like to be able to have the strings 'foo' and 'bar' available somehow.

Any advice or comments greatly appreciated.

Carl

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to