check_vector: Compare input to control input

View source: R/input-check.R

check_vectorR Documentation

Compare input to control input

Description

Compares the values of an input-vector against a control-vector containing valid values and returns the values of input that were found among the valid ones.

Usage

check_vector(
  input,
  against,
  ref.input = "input vector",
  ref.against = "valid options",
  ref.connect = "among",
  fdb.fn = "message",
  verbose = TRUE,
  with.time = FALSE
)

Arguments

input

A vector of any kind.

against

A vector of the same kind as input.

ref.input

The reference character value for input.

ref.against

The reference character value for against.

fdb.fn

Character value. Determines the function to call if a feedback message needs to be given. One of 'stop', 'warning' or 'message'.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

with.time

Logical value. Indicates whether the current time is to be added to the feedback message.

...

Additional arguments given to give_feedback().

Details

If none of the input values are found an error is raised with the message:

glue::glue("Did not find any element of ref.input in ref.against.")

If only some of the input values are found the function denoted in fdb.fn is called with the message:

glue::glue("Of ref.input did not find 'missing' in ref.against.")

Value

An informative error message about which elements of input were found in against or an invisible TRUE.


kueckelj/confuns documentation built on June 28, 2024, 9:19 a.m.