Skip to contents

Check that an object has the expected class

Usage

check_S7(x, class, arg = rlang::caller_arg(x), call = rlang::caller_env())

Arguments

x

The provided object to check.

class

The expected class of the object as a string.

arg

The name of the argument.

call

The call stack.

Value

Nothing. Called for side effects.

Examples

singer <- S7::new_class("singer", properties = list(
  name = S7::class_character,
  birthday = S7::class_Date
))

taylor <- singer(name = "Taylor Swift",
                 birthday = as.Date("1989-12-13"))
check_S7(taylor)