assert_class_any: Assert object is member of any class

assert_class_anyR Documentation

Assert object is member of any class

Description

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.

Details

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

Value

x, invisibly.

See Also

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

Examples

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

salim-b/pal documentation built on Feb. 28, 2025, 6:51 p.m.