Description Usage Arguments Value Examples
This is a version of ifelse that allows to check against multiple conditions
or alternatively a vectorized version of the when
function in purrr.
1 |
.x |
Vector of values to match against |
... |
Either formulas with a condition as LHS (optional) and an action as RHS. Or named arguments that define additional values to match against, i.e. that can be used in the formulas just like .x. |
The value resulting from the first valid condition for the given vector element is returned. Formulas without LHS or unnamed values are used as default.
1 2 3 4 5 | where(1:10,
y = 10:1,
.x <= 4 ~ y,
.x <= 6 ~ 11:20,
~ -.x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.