check_class: Check class of object

check_classR Documentation

Check class of object

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

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

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

Shians/CellBench documentation built on Oct. 16, 2023, 7:54 a.m.