On 28/06/2010 5:50 AM, Etienne Stockhausen wrote:
Hello everybody,
I'm trying to use a if-statment on a function. For a better
understanding I want to present a small example:
FUN=mean # could also be median,sd or
any other function
if (FUN == mean)
You could also consider
isTRUE(all.equal(FUN, mean))
> isTRUE(all.equal(mean, mean))
[1] TRUE
> isTRUE(all.equal(mean, median))
[1] FALSE
HTH
Keith J
"Patrick Burns" wrote in message
news:4c28777f.1040...@pburns.seanet.com...
> If I understand the problem properly,
> you want something li
If I understand the problem properly,
you want something like this:
function(FUN, ...)
{
FunName <- deparse(substitute(FUN))
if(FunName == "mean") {
...
} else if(FunName == "median") {
...
}
}
Using 'switch' is an alternative to 'i
Hello everybody,
I'm trying to use a if-statment on a function. For a better
understanding I want to present a small example:
FUN=mean # could also be median,sd or
any other function
if (FUN == mean)
plot(...)
if (FUN == median)
plot(...)
4 matches
Mail list logo