Dear list
I have a function and a vector, say
f - function(a,b){a+b}
x - c(2,3)
I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would
like it to be so that I can write f(x). (I know I can write a wrapper function
g - function(x){f(x[1],x[2])}, but this is not really
Try this:
do.call(f, as.list(x))
On 8/22/07, Søren Højsgaard [EMAIL PROTECTED] wrote:
Dear list
I have a function and a vector, say
f - function(a,b){a+b}
x - c(2,3)
I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would
like it to be so that I can write f(x). (I
On 8/22/07, Søren Højsgaard [EMAIL PROTECTED] wrote:
I have a function and a vector, say
f - function(a,b){a+b}
x - c(2,3)
I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would
like it to be so that I can write f(x). (I know I can write a wrapper
function g -