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, ...))
For every element of ... whose name matches an element of Expr,
that element's value.
Arguments
Expr
A character vector.
...
As in switch, a list of named alternatives.
Unlike switch, unnamed vectors are taken to match "". Likewise,
NA values in Expr must be assigned via IF_NA.
DEFAULT
A mandatory default value should any name of ... be left unmatched.
IF_NA
Optional value to replace missing (NA_character_) values in Expr.
MUST_MATCH
(logical, default: FALSE) Must every value in Expr be matched by a conversion in ...?
If TRUE any output equal to the value of DEFAULT is an error.