Yes, that's this.
Thank you very much. 2012/7/20 Peter Ehlers [via R] <ml-node+s789695n463721...@n4.nabble.com> > On 2012-07-20 04: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? > > Is this what you have in mind: > > myfunc <- function(a, b, c){ sqrt(a)-exp(b)+4*c } > myfunc2 <- function(x){ > a <- x[1] > b <- x[2] > c <- x[3] > myfunc(a, b, c) > } > > x <- c(1, 4, 9) > y <- 1:2 > z <- c(10, -10, 2, 20) > d <- expand.grid(x, y, z) > d$value <- apply(d, 1, myfunc2) > > ? > > Peter Ehlers > > > > > 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. > > > > ______________________________________________ > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=4637212&i=0>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. > > > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4637212&i=1>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. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://r.789695.n4.nabble.com/Execute-a-function-tp4637182p4637212.html > To unsubscribe from Execute a function, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4637182&code=Y2FybGFtZ21tQGdtYWlsLmNvbXw0NjM3MTgyfDE3NjAxODQ0MA==> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- Carla Moreira -- View this message in context: http://r.789695.n4.nabble.com/Execute-a-function-tp4637182p4637213.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@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.