See
?Control
If you want a:
With one value
if(cond) expr
if(cond) cons.expr else alt.expr
where:
if(1>2) {
print("1>2")
} else if(FALSE) {
print (FALSE)
} else {
print("2>1")
}
x = if(4 > 3) { 1 } else { 0 }
If else takes vectors as input and return vector on output
df$TOTAL_TIME_SEC_CAPPED <- ifelse(df$TOTAL_TIME_SEC > 200, 200, df$TOTAL_TIME_SEC)