[R] "return" function

Chris Marshall chris.marshall at wrx-us.com
Fri Sep 14 16:47:56 CEST 2001

I tried to write a function like this

f1 <- function(){
   if (condition 1) return
   if (condition 2) return
   if (condition 3) return

   do more work

Where I am using return to exit the function prematurely when I detect
conditions that warrant it.  Return doesn't seem to work this way.

How should I do this?

Chris Marshall
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