Skip to contents

Check if an argument is a positive numeric scalar.

Usage

check_positive_scalar(x, alt_null = FALSE)

Arguments

x

Function argument that is being checked.

alt_null

Logical. If TRUE, NULL is treated as valid input.

Value

If the argument is a positive numeric scalar, it returns invisible NULL. Otherwise, the function throws an error.

Examples

if (FALSE) { # \dontrun{
check_positive_scalar(5)
check_positive_scalar(-3)
check_positive_scalar("text")
check_positive_scalar(c(1, 2))
check_positive_scalar(NULL, alt_null = TRUE)
} # }