check_class: Check class of object

Description Usage Arguments Value Examples

Description

Check an object against a vector of class names. Testing if they match any or all of the classes. For is_all_of, the object needs to be at least every class specified, but it can have addition classes and still pass the check.

Usage

1
2
3
4
5
is_one_of(x, classes)

is_any_of(x, classes)

is_all_of(x, classes)

Arguments

x

the object to check

classes

the vector of strings of class names

Value

boolean value for the result of the check

Examples

1
2
3
4
5
is_one_of(1, c("numeric", "logical")) # TRUE
is_one_of(1, c("character", "logical")) # FALSE

is_all_of(1, c("numeric", "logical")) # FALSE
is_all_of(tibble::tibble(), c("tbl", "data.frame")) # TRUE

CellBench documentation built on Nov. 8, 2020, 5:11 p.m.