Skip to contents

This function checks whether an object is_char_scalar(). If the check fails, a formatted error is raised using cli::cli_abort().

Usage

check_char_scalar(x)

Arguments

x

An R object to check.

Value

Invisibly returns TRUE on check pass. Throws a error of class rlang::rlang_error on check fail.

Examples

check_char_scalar("hello")      # passes
check_char_scalar("  hi  ")     # passes
if (FALSE) { # \dontrun{
check_char_scalar("")           # error
check_char_scalar("   ")        # error
check_char_scalar(42)           # error
check_char_scalar(c("a", "b"))  # error
check_char_scalar(NA)           # error
check_char_scalar(NULL)         # error
} # }