Skip to contents

Asserts that an object is member of any of the specified classes.

Usage

assert_class_any(x, classes, name = "x")

Arguments

x

R object to test.

classes

Class names to check for inheritance. A character vector.

name

Name of the checked object to print in error message in case the assertion fails. A character scalar.

Value

x, invisibly.

Details

In contrast to checkmate::assert_class(), this function returns TRUE as long as x is at least member of one of classes.

See also

Other functions extending the checkmate package: assert_cli(), assert_df_or_tibble(), assert_inf_count(), assert_mime_type(), assert_pkg()

Examples

xml2::read_html("https://pal.rpkg.dev/dev/license") |>
  assert_class_any(classes = c("xml_document", "xml_nodeset", "xml_node"))