Hello,
Use ?formals.
> formals(myfunction)
$a
$b
$c
$...
Hope this helps,
Rui Barradas
Em 17-02-2014 21:22, Jonathan Greenberg escreveu:
R-helpers:
I'm guessing this is an easy one for some of you, but I'm a bit
stumped. Given some arbitrary function (doesn't matter what it does):
myfunction <- function(a,b,c)
{
return(a+b+c)
}
I want to test this function for the presence of the ellipses ("...")
and, if they are missing, create a new function that has them:
myfunction <- function(a,b,c,...)
{
return(a+b+c)
}
So, 1) how do I test for whether a function has an ellipses argument
and, 2) how do I "append" the ellipses to the argument list if they do
exist?
Note that the test/modification should be done without invoking the
function, e.g. I'm not asking how to test for this WITHIN the
function, I'm asking how to test "myfunction" directly as an R object.
Thanks!
--j
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.