Seeks a unique match of its first argument among the elements of its second. If successful, it returns this element; otherwise, it performs an action specified by the third argument.
char.expand(input, target, nomatch = stop("no match"))
| Parameter | Description |
|---|---|
input |
a character string to be expanded. |
target |
a character vector with the values to be matched against. |
nomatch |
an R expression to be evaluated in case expansion was not possible. |
# NOT RUN {
locPars <- c("mean", "median", "mode")
char.expand("me", locPars, warning("Could not expand!"))
char.expand("mo", locPars)
# }