assert_match_arg: Checkmate Compatible Version of 'match.arg'

Description Usage Arguments See Also

Description

Matches arguments as match.arg and returns the value of the selected argument.

Usage

1
2
assert_match_arg(x, choices, several_ok = FALSE,
  .var.name = checkmate::vname(x), add = NULL)

Arguments

x

A character vecotr (of length one unless several.ok is TRUE or NULL.

choices

A character vector of candidate values

several_ok

logical specifying if arg should be allowed to have more than one element.

.var.name

character(1), name of the checked object to print in assertions. Defaults to the heuristic implemented in vname

add

AssertCollection, Colleciton to store assertion messages. See link[checkmate]{AssertCollection}.

...

Additional arguments to pass to either assertChoice or assertSubset. assertChoice is used when several_ok = FALSE, otherwise assertSubset is used.

See Also

match.arg, assertChoice, assertSubset



Search within the pixiedust package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.