is2: Alternative version of is

Description Usage Arguments Value See Also Examples

View source: R/coercion.R

Description

If a function named is.class exists, call is.class(x). If not, call is(x, class).

Usage

1
is2(x, class, .xname = get_name_in_parent(x))

Arguments

x

Input to check.

class

Target class that x maybe belong to.

.xname

Not intended to be used directly.

Value

TRUE if x belongs to the class and FALSE otherwise.

See Also

is, and assert_is_all_of for the corresponding assert fns.

Examples

1
2
3
4
is2(1:5, "character")
is2(matrix(1:5), "character")
is2(1:5, c("character", "list", "numeric"))
is2(mean, c("function", "data.frame"))

assertive.base documentation built on Feb. 8, 2021, 9:06 a.m.