Skip to content
Prev 10170 / 398503 Next

outer

Olivier Martin wrote:
If you supply vectors to if(y>x), then just the first element is
actually used. ifelse does the job:

fun <- function(x,y) { ifelse(y>x, x+y, 0) }

should solve your problem
Achim

---------------------------
Institut f?r Statistik
Technische Universit?t Wien
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._