[R] Execute a function

Jessica Streicher j.streicher at micromata.de
Fri Jul 20 14:06:23 CEST 2012


You mean executing the function for all combinations of values?
For example, if you have a<-b<-c<-1:2
you would get back the values of

myfunc(1,1,1)
myfunc(1,1,2)
myfunc(1,2,1)
myfunc(1,2,2)
myfunc(2,1,1)
myfunc(2,1,2)
myfunc(2,2,1)
myfunc(2,2,2)

?

On 20.07.2012, at 13:05, carla moreira wrote:

> 
> Hi,
> 
> I would like to evaluate a function, with 3 arguments, for instance, 
> 
> myfunc<-function(a,b,c) { sqrt(a)-exp(b)+4*c
>                                                }
> 
> How to execute  myfunc(x,y,z), for all x, all y and all z, where x,y,z are
> vectors?
> 
> Thank you very much in advance
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Execute-a-function-tp4637182.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list