Skip to content
Prev 22327 / 398502 Next

Arguments of a function

Hello,
Is it possible to call a function having x arguments with vector 
containing the x values of the arguments in it ?
To make myself clearer, I was wandering if from a function f:

    > f
    function(a,b) a+b

and a vector v which the 2 values of the arguments "a" and "b":

    > v
    a b
    1 2
    > names(v)
    [1] "a" "b"

it is possible to call the function f with vector v as the arguments of the function.
If I use f(v) it returns me an error since v was considered as the value of the first argument.

Do you any ideas ??
 
_______________________________________

Florent BATY
CNRS UMR 5558
Dynamique des Populations Bact?riennes
Facult? de M?decine Lyon-Sud
69921 OULLINS, BP 12
FRANCE
tel : +33 (0)4 78 86 31 67
fax : +33 (0)4 78 86 31 49
_______________________________________



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._