The bc_ifelse() method
performs a broadcasted form of ifelse.
Usage
bc_ifelse(test, yes, no, ...)
# S4 method for ANY
bc_ifelse(test, yes, no)
Value
The output, here referred to as out,
will be an array of the same type as yes and no.
If test has the same dimensions as bc_dim(yes, no),
then out will also have the same dimnames as test.
If test is a broadcaster, then out will also be a broadcaster.
After broadcasting yes against no,
given any element index i,
the following will hold for the output:
when test[i] == TRUE, out[i] is yes[i];
when test[i] == FALSE, out[i] is no[i];
when test[i] is NA,
out[i] is NA when yes and no are atomic,
and out[i] is list(NULL) when yes and no are recursive.
Arguments
test
a vector or array,
with the type logical, integer, or raw,
and a length equal to prod(bc_dim(yes, no)).
If yes / no are of type raw, test is not allowed to contain any NAs.
yes, no
conformable vectors/arrays of the same type.
All atomic types are supported.
Recursive arrays of type list are also supported.