This is equivalent to base::match.arg() with a few differences:
Partial matches trigger an error.
Error messages are a bit more informative and obey the tidyverse standards.
arg_match(arg, values = NULL)
| arg | A symbol referring to an argument accepting strings. |
|---|---|
| values | The possible values that |
The string supplied to arg.
#> [1] "bar"# This would throw an informative error if run: # fn("b") # fn("baz")