Learn R Programming

checkthat (version 0.1.0)

validate_logical_vec: Validate a Logical Vector

Description

Validates a logical vector to ensure it meets specific criteria:

  • Must have a length of at least 1.

  • Must be a logical-type vector.

  • If all values are NA, it will raise a warning.

Usage

validate_logical_vec(logical_vec)

Value

TRUE if the logical vector is valid, otherwise it throws an error.

Arguments

logical_vec

Logical vector to validate.

See Also

is_proportion, is_count, validate_proportion, validate_count

Examples

Run this code
validate_logical_vec(c(TRUE, FALSE, TRUE)) # TRUE
try(validate_logical_vec(c())) # Error
validate_logical_vec(c(NA, NA)) # Warning

Run the code above in your browser using DataLab