Description Usage Arguments Details Value Author(s) See Also Examples
Case-insensitive match and pmatch functions, especially useful
in parsing user inputs, e.g. from command line.
1 |
x |
String vector |
table |
A vector to be matched |
... |
Other parameters passed to |
imatch and ipmatch works similar as match and
pmatch, except that they are case-insensitive.
matchv, imatchv and ipmatchv are shot-cuts to get the
matched value (therefore the āvā) if the match succeeded, or
NA if not. match(x, table) is equivalent to
table[match(x, table)]. See examples.
imatch and ipmatch returns matching indices, or
NA (by default) if the match failed.
matchv, imatchv and ipmatchv returns the matching
element in table, or NA if the match failed. Note that when
cases are different in x and table, the one in table
will be returned. This is especially useful for cases where user's input has
different cases as the internal options.
Jitao David Zhang <jitao_david.zhang@roche.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | user.input <- c("hsv", "BvB")
user.input2 <- c("HS", "BV")
internal.options <- c("HSV", "FCB", "BVB", "FCN")
match(user.input, internal.options)
imatch(user.input, internal.options)
ipmatch(user.input, internal.options)
ipmatch(user.input2, internal.options)
matchv(user.input, internal.options)
matchv(tolower(user.input), tolower(internal.options))
imatchv(user.input, internal.options)
ipmatchv(user.input, internal.options)
ipmatchv(user.input2, internal.options)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.