vmap {formattable} | R Documentation |
Vectorized map from element to case by index or string value
Description
This function is a vectorized version of switch
, that is, for
each element of input vector, switch
is evaluated and the results are
combined.
Usage
vmap(EXPR, ..., SIMPLIFY = TRUE)
Arguments
EXPR |
an expression evaluated to be character or numeric vector/list. |
... |
The list of alternatives for each |
SIMPLIFY |
|
See Also
Examples
x <- c("normal","normal","error","unknown","unknown")
vmap(x, normal = 0, error = -1, unknown = -2)
x <- c(1,1,2,1,2,2,1,1,2)
vmap(x, "type-A", "type-B")
[Package formattable version 0.2.1 Index]