Skip to contents

Check if an argument is a character scalar. Optionally allows NULL.

Usage

check_string(..., alt_null = FALSE)

Arguments

...

Function argument that is being checked.

alt_null

Logical. Should argument accept NULL value.

Value

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

Examples

if (FALSE) { # \dontrun{
check_string("text")
check_string("")
check_string(NULL, alt_null = TRUE)
check_string(1)
check_string(c("a", "b"))
} # }