Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is2

Alternative version of is


Description

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

Usage

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

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

assertive.base

A Lightweight Core of the 'assertive' Package

v0.0-9
GPL (>= 3)
Authors
Richard Cotton [aut, cre], Sunkyu Choi [trl], Ivanka Skakun [trl], Gergely Dar<c3><b3>czi [trl], Anton Antonov [trl], Hisham Ben Hamidane [trl], Anja Billing [trl], Aditya Bhagwat [trl], Rasmus B<c3><a5><c3><a5>th [trl], Mine Cetinkaya-Rundel [trl], Aspasia Chatziefthymiou [trl]
Initial release
2021-02-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.