Displaying 1 result from an estimated 1 matches for "evalb".
Did you mean:
eval
2007 Jul 24
1
Passing equations as arguments
Friends,
I'm trying to pass an equation as an argument to a function. The idea is as follows. Let us say i write an independent function
Ideal Situation:
ifunc <- function(x)
{
return((x*x)-2)
}
mainfunc <- function(a,b)
{
evala <- ifunc(a)
evalb <- ifunc(b)
if (evala>evalb){return(evala)}
else
return(evalb)
}
Now I want to try and write this entire program in a single function with the user specifying the equation as an argument to the function.
myfunc <- function(a, b, eqn)
{
func1 <- function (x) ??????????????????...