ifelse2 returns a value with the same shape as test which is filled with elements selected from either yes or no depending on whether the element of test is TRUE or FALSE. Modified from ifelse.
Usage
ifelse2(test, yes, no)
Arguments
test
an object which can be coerced to logical mode.
yes
return values for true elements of test.
no
return values for false elements of test.
Details
The only difference from ifelse is that, when missing valuses in test, ifelse gives missing values in the result, whereas ifelse2 gives values for false elements of test.