These low-level functions provide faster alternatives to
some uses of ifelse. They were developed by
trial-and-error comparison of computation times of different expressions.
ifelse0NA(test) is equivalent to ifelse(test, 0, NA).
ifelse1NA(test) is equivalent to ifelse(test, 1, NA).
ifelseAB(test, a, b) is equivalent to ifelse(test, a, b)
where a and b must be single values.
ifelseAX(test, a, x) is equivalent to ifelse(test, a, x)
where a must be a single value, and x a vector of the
same length as test.
ifelseXB(test, x, b) is equivalent to ifelse(test, x, b)
where b must be a single value, and x a vector of the
same length as test.
ifelseXY(test, x, y) is equivalent to ifelse(test, x, y)
where x and y must be vectors of the
same length as test.
ifelseNegPos(test, x) is equivalent to ifelse(test, x, -x)
where x must be a vector of the same length as test.