Does the input contain a boolean flag?

isFlag(x, .xname = getNameInParent(x))

Arguments

x

Object.

.xname

Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause attribute set.

Examples

## TRUE ==== isFlag(TRUE)
#> [1] TRUE
isFlag(FALSE)
#> [1] TRUE
## FALSE ==== isFlag(c(TRUE, TRUE))
#> [1] FALSE #> Cause of failure: #> c(TRUE, TRUE) is not a boolean flag (TRUE/FALSE).
isFlag(1)
#> [1] FALSE #> Cause of failure: #> 1 is not a boolean flag (TRUE/FALSE).
isFlag(NA)
#> [1] FALSE #> Cause of failure: #> NA is not a boolean flag (TRUE/FALSE).