Description Usage Arguments Details Value Examples
Switch the values of the vector by another on specific indices.
1 2 3 |
.f |
( |
... |
arguments passed to the |
.then |
( |
.else |
( |
#' OX
evaluates function .f
which returns a vector of indices which
are then decide which values of .then
are replaced by else
.
1 |
Consequence of above is that idx = .f(...)
should be a logical
vector or
integer
vector which would be valid indices for .then
and .else
.
This means that .then
and .else
should be of the same length, but there
are two exceptions:
when .else
is a single value, than this value will replace .then
at
returned indices .then[!idx] <- .else
when .else
is NULL
To invert the switch one can use XO
which is equivalent of
OX(Negate(.f), ..., .then, .else)
.
atomic
or list
. Returned object is a .then
object with elements
replaced by .else
depending on a result of the logical condition.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.