Argument Matching

2018-11-30

Ignoring case

base

The base function match.arg() is good, but it doesn’t offer the possiblity to ignore case during argument matching. Sometimes it’s good to ignore case; for example, if you’re matching the arguments c("yes", "no"), there’s no need to worry about case.

strex

The default behaviour of strex::match_arg() is to observe case, but case ignorance can be turned on with ignore_case = TRUE.

Error Messages

You can begin to see above that the error message from strex::match_arg() are more informative and nicely formatted. Here are a few more examples.

No matches

Multiple matches

Wrong arg length

Duplicate elements in choices