Learn R Programming

yulab.utils (version 0.2.2)

check_input: Check input validity with detailed error messages

Description

Enhanced input validation with support for basic types and improved error messages

Usage

check_input(
  x,
  type = NULL,
  length = NULL,
  min_length = NULL,
  max_length = NULL,
  allow_null = FALSE,
  arg_name = "input"
)

Value

Invisible TRUE if valid, throws error otherwise

Arguments

x

Object to check

type

Expected type (can be basic type like "numeric", "character" or class name)

length

Expected length (optional)

min_length

Minimum length (optional)

max_length

Maximum length (optional)

allow_null

Whether NULL is allowed

arg_name

Name of the argument for error messages