check_classes: Check Classes

View source: R/classes.R

check_classesR Documentation

Check Classes

Description

Checks that an object inherits from one or more classes.

Usage

check_classes(
  x,
  classes = character(0),
  exclusive = FALSE,
  order = FALSE,
  x_name = substitute(x),
  error = TRUE
)

Arguments

x

The object to check.

classes

A character vector of the classes x should inherit from.

exclusive

A flag indicating whether other classes are not permitted.

order

A flag indicating whether the object classes have to occur in the same order as classes.

x_name

A string of the name of the object x.

error

A flag indicating whether to throw an informative error or immediately generate an informative message if the check fails.

Details

The classes of an object can be returned using the class() function.

Value

An invisible copy of x (if it doesn't throw an error).

See Also

check_inherits

Examples

check_classes(list())
check_classes(list(), "list")
check_classes(list(), "numeric", error = FALSE)

poissonconsulting/checkr documentation built on Oct. 18, 2023, 9:39 p.m.