validate_boolean: Boolean value(s) validation

View source: R/validate.R

validate_booleanR Documentation

Boolean value(s) validation

Description

Check that each element of x is either TRUE or FALSE. Works with vectors containing logical values, and/or 0s and 1s, and/or "true", "t", "false", "f" and "na" strings (regardless of case). Coerce the non logical values to their logical equivalent. If keepMissing is FALSE (default), missing values will be coerced to FALSE.

Usage

validate_boolean(x, name = lang2str(x), keepMissing = FALSE)

Arguments

x

(character | numeric | integer | logical) A vector.

name

(character) The name of the vector (used in error messages). Optional.

vectorize

(logical) Whether to vectorize the function when x has length > 1 (TRUE; Default)

keepNA

(logical) Whether to keep NA values (TRUE) or coerced them to false (FALSE; Default)

Value

A logical vector


salix-d/salix_miscFuns documentation built on Aug. 14, 2024, 7:45 p.m.