Skip to contents

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

Usage

check_numeric_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_numeric_scalar(5)       # passes
check_numeric_scalar(0.1)     # passes
if (FALSE) { # \dontrun{
check_numeric_scalar(NA)      # throws error
check_numeric_scalar(NULL)    # throws error
check_numeric_scalar(c(1,2))  # throws error
check_numeric_scalar("5")     # throws error
} # }