check_inherits: Check class of object

View source: R/check.R

check_inheritsR Documentation

Check class of object

Description

Check class of object

Usage

check_inherits(x, cl, allow_null = TRUE, arg_name = deparse(substitute(x)))

Arguments

x

Object to check.

cl

Character: class to check against.

allow_null

Logical: If TRUE, NULL values are allowed and return early.

arg_name

Character: Name of the variable for error messages.

Value

Called for side effects. Throws an error if checks fail.

Author(s)

EDG

Examples

check_inherits("papaya", "character")
# These will throw errors:
try(check_inherits(c(1, 2.5, 3.2), "integer"))
try(check_inherits(iris, "list"))

rtemis.core documentation built on April 22, 2026, 1:11 a.m.