Skip to contents

Assert that an input is a single logical value

Usage

.assert_scalar_flag(x, arg)

Arguments

x

The input to check.

arg

The name of the argument being checked, used in error messages.

Value

Invisibly returns NULL if the check passes. Otherwise, throws an error.

Details

This function is used internally to validate that certain inputs are single logical values (flags). It checks that x is of type logical, has length 1, and is not NA. If any of these conditions fail, an informative error message is thrown indicating the argument name and the nature of the issue.