Skip to contents

This modifies a predicate function to ignore NAs.

Usage

mod_nullable(pred)

Arguments

pred

A predicate function

Value

A new predicate that allows NAs

Examples

# The `is_incrementing` predicate will fail if there are NAs
x <- c(1, NA, 3)
is_incrementing(x) # FALSE
#> [1] FALSE

is_incrementing_null <- mod_nullable(is_incrementing)
is_incrementing_null(x) # TRUE
#> [1] TRUE