[R] Arguments of a function

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Aug 2 15:01:37 CEST 2002


?do.call

On Fri, 2 Aug 2002, Florent BATY wrote:

> 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 ??

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list