See strex::match_arg()
.
match_arg(arg, choices = NULL, index = FALSE, several_ok = FALSE,
ignore_case = FALSE)str_match_arg(arg, choices = NULL, index = FALSE, several_ok = FALSE,
ignore_case = FALSE)
A character vector (of length one unless several_ok = TRUE
).
A character vector of candidate values.
Return the index of the match rather than the match itself?
Allow arg
to have length greater than one to match
several arguments at once?
Ignore case while matching. If this is TRUE
, the
returned value is the matched element of choices
(with its original
casing).