I would like to write an if statement of the following form:
a=5 b=2 la<-function(a,b){ if(a>3){a} else{b} }
Now what I would like t
You should use the semicolon
if(a>3){c<-1000;a}
The last statement is the return value.
EDIT This works for multiple statements, too. You can omit the semicolon if you use line breaks, as in
if(a>3) { c<-1000 d<-1500 a } else { e <- 2000 b }