test according to the logical values
in
test.
ifelse(test, yes, no)
bdVector containing values to be returned for elements with
test
equal to
TRUE.
bdVector containing values to be returned for elements with
test
equal to
FALSE.
test and data values
from the values of
yes or
no depending on
test
. If
yes or
no are not as long as
test,
they will be repeated cyclically.
NA values in
test cause
NAs in the result.
# This example avoids the warning message from taking logs of # negative numbers. log(ifelse(x>0, x, NA)) # compare to the example in 'if'.