match_arg | R Documentation |
match.arg matches arguments against a table of candidate values as specified
by choices. Matching is done using grep
, and arguments
may be abbreviated. If ignore.case = TRUE
, case is ignored when performing
the matching.
match_arg(
x,
choices,
several.ok = FALSE,
ignore.case = FALSE,
.var.name = checkmate::vname(x),
comment = NULL,
add = NULL
)
x |
[character] |
choices |
[character()] |
several.ok |
[logical(1)] |
ignore.case |
[ |
.var.name |
[ |
comment |
[ |
add |
[ |
Partial Argument Matching
This is an extensions to matchArg
with support
for ignore.case
and comment
. matchArg
is an
extension of match.arg
with support for AssertCollection
.
The behavior is very similar to match.arg
, with a few
exceptions:
NULL
is not a valid value for x
.
When several.ok
= TRUE
, it is required that all
values for x
match a value in choices
and that
each value in x
matches only one value in choices
.
When several.ok
= FALSE
, it is required that
length(x)
== 1 and that x
matches one and only one
value in choices
.
Character vector with subset of choices
.
match_arg("a", choices = c("Apple", "Banana"), ignore.case = TRUE)
match_arg(c("a", "Ban"), choices = c("Apple", "Banana"), several.ok = TRUE, ignore.case = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.