# predicates-boolean: Boolean predicates In egnha/rong: Functional Input Validation

## Description

Boolean predicates

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```chk_true(x) chk_is(x) chk_false(x) chk_not(x) chk_all(x, na.rm = FALSE) chk_any(x, na.rm = FALSE) chk_none(x, na.rm = FALSE) chk_all_map(x, .f, na.rm = FALSE) chk_any_map(x, .f, na.rm = FALSE) chk_none_map(x, .f, na.rm = FALSE) ```

## Arguments

 `x` Object to test. `.f` Function to map over the expressions to validate. `na.rm` Should `NA` values be disregarded?

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```f <- function(x, y) NULL ## Require x, y to have the same length foo <- firmly(f, chk_true(length(x) == length(y))) foo(runif(3), rnorm(3)) ## Not run: foo(runif(2), rnorm(3)) ## End(Not run) ## Require x to contain only non-empty objects msg <- "{{.}} contains empty objects" bar <- firmly(f, !! msg := chk_all_map(function(.) length(.) != 0, x)) bar(1:2) ## Not run: bar(list(1, NULL)) ## End(Not run) ## Or more efficiently, in a vectorized manner: baz <- firmly(f, chk_all("x contains empty objects" := lengths(x) != 0)) baz(1:2) ## Not run: baz(list(1, NULL)) ## End(Not run) ```

egnha/rong documentation built on May 7, 2019, 9:48 p.m.