g6tr.ui is a lightweight helper package for internal Gradient packages:
- validating function inputs with consistent
check_*()assertions, - printing standardized CLI messages.
It helps keep error messages and argument checks uniform across packages.
Quick Example
library(g6tr.ui)
# scalar and class checks
check_scalar("abc", arg_class = "character")
check_bool(TRUE)
# optional argument pattern (allow NULL)
check_string(NULL, alt_null = TRUE)
check_prob_scalar(NULL, alt_null = TRUE)
# vector checks
check_natural(c(1, 2, 3))
check_allowed_strings(c("a", "b"), c("a", "b", "c"))Core Helpers
- Type and shape checks:
check_class(),check_length(),check_scalar() - Numeric checks:
check_positive_scalar(),check_nonnegative_scalar(),check_prob() - Integer checks:
check_integer(),check_nonnegative_integer(),check_natural() - String checks:
check_string(),check_strings(),check_allowed_strings() - File/path checks:
check_file(),check_dir()