Skip to contents

Function for checking if an object is of a specific type or class.

Usage

check_class_and_type(
  object,
  object_name = NULL,
  type_classes = "bool",
  allow_NULL = FALSE,
  min = NULL,
  max = NULL,
  allowed_values = NULL
)

Arguments

object

Any R object.

object_name

string Name of the object. This is helpful for debugging.

type_classes

vector of strings containing the type or classes which the object should belong to.

allow_NULL

bool If TRUE allow the object to be NULL.

min

double or int Minimal value for the object.

max

double or int Maximal value for the object.

allowed_values

vector of strings determining the allowed values. If all strings are allowed set this argument to NULL.

Value

Function does nothing return. It raises an error if the object is not of the specified type.

Note

parameter min, max, and allowed_values do not apply if type_classes is a class.

allowed_values does only apply if type_classes is string.

See also

Other Utils Checks Developers: check_all_args()