validate_logical_vec {checkthat} | R Documentation |
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)
Arguments
logical_vec |
Logical vector to validate. |
Value
TRUE
if the logical vector is valid, otherwise it throws an
error.
See Also
is_proportion
, is_count
,
validate_proportion
, validate_count
Examples
validate_logical_vec(c(TRUE, FALSE, TRUE)) # TRUE
try(validate_logical_vec(c())) # Error
validate_logical_vec(c(NA, NA)) # Warning
[Package checkthat version 0.1.0 Index]