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
On Feb 17, 2014, at 1:22 PM, Jonathan Greenberg wrote:
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
Here are two ways:
## construct formals adding ...
f - c(formals(myfunction), unlist(alist(... = )))
## replace the formals, excluding the extra ... if it previously existed
formals(myfunction) - f[!duplicated(names(f))]
## 2nd way, searching for ... and doing the replacement only if it is not
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):
4 matches
Mail list logo