match_input

0th

Percentile

Match user inputs to expected values

Match each user input to an expected/allowed value.

Keywords
internal
Usage
match_input(
  user,
  expected,
  fail_action = c("stop", "warning", "message", "nothing"),
  user_value_label = NULL
)
Arguments
user

Character vector of user input. These will be matched to expected using match.arg().

expected

Character vector of expected/allowed values.

fail_action

If any value in user could not be matched, or repeated matches occured, what should happen? Possible values are "stop" (default; raises an error), "warning", and "nothing".

user_value_label

How to refer to the user input in a stop or warning message. If NULL, no label is used.

Details

Raise a warning if either several user inputs match the same expected value, or at least one could not be matched to any expected value. ciftiTools uses this function to match keyword arguments for a function call. Another use is to match brainstructure labels ("left", "right", or "subcortical").

Value

The matched user inputs

Aliases
  • match_input
Documentation reproduced from package ciftiTools, version 0.1.6.0, License: GPL-3

Community examples

Looks like there are no examples yet.