[R] Evaluate a function for various value of parameters

Olaf Mersmann olafm at tako.de
Sat Oct 23 00:29:55 CEST 2004


Hi Stephane,

* Stephane DRAY <dray at biomserv.univ-lyon1.fr> [041023 00:20]:
> Hello list,
> 
> I have a problem ... and do not know how to solve it.
> I would like create a function that estimate the quality of the fit of 
> different functions with different values of parameters.
> This problem is related to the following one:
> I would like to create a function "evaluatemyfunction" which evaluate a 
> function f for different values of parameters. For instance, if
> f=function(a,b) a*b
> evaluatemyfunction(f,1:10,5) would return:
> 5
> 10
> 15...
> 
> I would like that f could have a variable number of arguments. I have begin 
> to write a function:

That function has already been written for you. Lookup 'mapply' in the
online help.

HTH
Olaf




More information about the R-help mailing list