vmap | R Documentation |
This function is a vectorized version of switch()
, that is, for
each element of input vector, switch()
is evaluated and the results are
combined.
vmap(EXPR, ..., SIMPLIFY = TRUE)
EXPR |
an expression evaluated to be character or numeric vector/list. |
... |
The list of alternatives for each |
SIMPLIFY |
|
switch()
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.