is_value: One dimensional input check

View source: R/input-check.R

is_valueR Documentation

One dimensional input check

Description

Checks if input fits the requirements and gives feedback via give_feedback().

Usage

is_value(
  x,
  mode,
  ref = NULL,
  fdb.fn = "stop",
  verbose = TRUE,
  skip.allow = FALSE,
  skip.val = NULL,
  with.time = FALSE
)

is_vec(
  x,
  mode,
  ref = NULL,
  of.length = NULL,
  min.length = NULL,
  max.length = NULL,
  skip.allow = FALSE,
  skip.val = NULL,
  fdb.fn = "stop",
  verbose = TRUE,
  with.time = FALSE
)

are_values(
  ...,
  mode,
  fdb.fn = "stop",
  verbose = TRUE,
  with.time = FALSE,
  skip.allow = FALSE,
  skip.val = NULL,
  return = "boolean"
)

are_vectors(
  ...,
  mode,
  fdb.fn = "stop",
  verbose = TRUE,
  with.time = FALSE,
  of.length = NULL,
  min.length = NULL,
  max.length = NULL,
  skip.allow = FALSE,
  skip.val = NULL,
  return = "boolean"
)

Arguments

x

Input vector.

mode

Character value. The type of which the input must be.

ref

Character value. Input reference for the error message. If set to NULL the value of x is evaluated via non standard evalulation.

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 value. Indicates whether any kind of feedback is supposed to be given. verbose set to FALSE shuts down any error, warning or general messages and results in the functions returning what is specified in return.

skip.allow

Logical. Allows the function to be skipped if x and skip.val are identical.

skip.val

The value that x needs to be equal to in order for the check to be skipped.

with.time

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

of.length

Numeric value. Denotes that the vector has to be of a certain length. Holds priority over min.length and max.length - if not set to NULL the letter two are ignored.

min.length, max.length

Numeric value. Denotes that the vector has to be of certain minimal and/or maximal length.

...

Character vector denoting the objects to be checked.

return

Character value. Either 'boolean' which makes the function return an invisible TRUE or FALSE depending on if all tests evaluated to TRUE or not. Or 'results' which returns a named vector of all results.

Value

An invisible TRUE or an informative error message.

Examples

# Not run:

 vec1 <- c(1,2),
 vec2 <- c(1,2,3,4,5)

 is_vec(x = vec1, mode = "numeric", of.length = 2)

 are_vectors(c("vec1", "vec2"), mode = "numeric", min.length = 2)




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