check_optional_bounded_integer_scalar: Check optional integer scalar within bounds

View source: R/check.R

check_optional_bounded_integer_scalarR Documentation

Check optional integer scalar within bounds

Description

Check optional integer scalar within bounds

Usage

check_optional_bounded_integer_scalar(
  x,
  lower = -Inf,
  upper = Inf,
  arg_name = deparse(substitute(x))
)

Arguments

x

Optional Numeric: Value to check. Must be NULL or a single non-NA whole number within bounds.

lower

Numeric scalar: Lower bound, inclusive.

upper

Numeric scalar: Upper bound, inclusive.

arg_name

Character: Argument name to use in error messages.

Value

Called for side effects. Throws an error if checks fail.

Author(s)

EDG

Examples

check_optional_bounded_integer_scalar(NULL)
check_optional_bounded_integer_scalar(5L, lower = 0, upper = 20)
# Throw error:
try(check_optional_bounded_integer_scalar(25, lower = 0, upper = 20))

rtemis.core documentation built on Sept. 20, 2026, 9:06 a.m.