Present since hutils 1.2.0
. Vectorized version of switch
. Used to avoid or make clearer the result of
if_else(Expr == , ..1, if_else(Expr == , ..2, ...))
Switch(Expr, ..., DEFAULT, IF_NA = NULL, MUST_MATCH = FALSE)
Expr | A character vector. |
---|---|
... | As in |
DEFAULT | A mandatory default value should any name of |
IF_NA | Optional value to replace missing ( |
MUST_MATCH | (logical, default: |
For every element of ...
whose name matches an element of Expr
,
that element's value.
#> [1] 1 2 3 1