Checks that an object inherits from one or more classes.
check_classes(
x,
classes = character(0),
exclusive = FALSE,
order = FALSE,
x_name = substitute(x),
error = TRUE
)
The object to check.
A character vector of the classes x should inherit from.
A flag indicating whether other classes are not permitted.
A flag indicating whether the object classes have to occur in the same order as classes.
A string of the name of the object x.
A flag indicating whether to throw an informative error or immediately generate an informative message if the check fails.
An invisible copy of x (if it doesn't throw an error).
The classes of an object can be returned using the class()
function.
check_classes(list())
#> Warning: `check_classes()` was deprecated in checkr 0.5.1.
#> Please use chk::chk_is(), chk::chk_s3_class(), chk::chk_s4_class(), or chk::check_values() instead.
check_classes(list(), "list")
#> Warning: `check_classes()` was deprecated in checkr 0.5.1.
#> Please use chk::chk_is(), chk::chk_s3_class(), chk::chk_s4_class(), or chk::check_values() instead.
check_classes(list(), "numeric", error = FALSE)
#> Warning: `check_classes()` was deprecated in checkr 0.5.1.
#> Please use chk::chk_is(), chk::chk_s3_class(), chk::chk_s4_class(), or chk::check_values() instead.
#> Warning: list() must inherit from class numeric