README.md

not predicates and friends

R package containing not predicates and set operators

not in set

x %!in% y
x %not_in% y
x %without% y # equivalent to setdiff(x, y) without the call to unique()

not predicates

Most of these are straight negations of the predicate tests in package:purrr

is_not_atomic(x)
is_not_bare_atomic(x)
is_not_bare_character(x)
is_not_bare_double(x)
is_not_bare_integer(x)
is_not_bare_list(x)
is_not_bare_logical(x)
is_not_bare_numeric(x)
is_not_bare_vector(x)
is_not_character(x)
is_not_double(x)
is_not_empty(x)
is_not_formula(x)
is_not_function(x)
is_not_integer(x)
is_not_list(x)
is_not_logical(x)
is_not_null(x)
is_not_numeric(x)
is_not_scalar_atomic(x)
is_not_scalar_character(x)
is_not_scalar_double(x)
is_not_scalar_integer(x)
is_not_scalar_list(x)
is_not_scalar_logical(x)
is_not_scalar_numeric(x)
is_not_scalar_vector(x)
is_not_vector(x)
is_not_na(x)
is_not_infinite(x)

Also for consistancy with snake_case naming, the following aliases are provided

is_na(x)         # alias for is.na(x)
is_infinite(x)   # alias for is.infinite(x)

all_identical

Test if all elements of a vector are identical. Test for equality is done with ==. Options to 1) allow for a return value of TRUE in cases where all(is.na(v)), or 2) ignore NA elements. Cases where length(v)<=1 return TRUE.

all_identical(v, allNA = FALSE, na.rm = FALSE)
not_all_identical(v, ...) # ... passed on to all_identical

is_named

Test if at least one element of a vector has a name that is not NA or ""? Optionally, test the type at the same time. Always returns either TRUE or FALSE, never returns NA, so safe to use in if().

is_named(x)
is_not_named(x)
is_named_character(x)
is_named_list(x)
is_named_numeric(x)
is_named_logical(x)

To install, run:

devtools::install_github("t-kalinowski/notr")


t-kalinowski/notr documentation built on May 31, 2019, 12:51 a.m.