[R] Pass an equation as an argument of a sub-function
Frank S.
|_j_rod @end|ng |rom hotm@||@com
Thu Jun 6 19:41:39 CEST 2019
Dear all,
I have defined an R function g(y) wich in turn is inside other R function f(x). The function g(y) depends on an
equation, and I would like to know if such an equation could be passed as an argument of the main function
(taking into account that we should change the variable "x" to "y").
As an example, I have:
function(x) { # Main function, called f(x)
----- (code)
function(y) { # Sub-function, called g(y)
----- (code)
eq <- y^2 -3*y
----- (code)
}
----- (code)
}
In summary, I would like to know is there is any way to:
Put the equation "eq" as an argument of the main function f(x).
Thank you very much!
Frank
[[alternative HTML version deleted]]
More information about the R-help
mailing list