object_class {ooplah}R Documentation

Get class of an object (possibly with inheritance)

Description

Find class of an object or an ancestor of the object. In contrast to class which returns a class object and all its ancestors, this function returns either the class of the object itself, or the class of one of its ancestors.

Usage

object_class(object, ancestor = 0)

get_object_class(object, ancestor = 0, ...)

object_classes(..., objects = list(...))

Arguments

object

ANY
Object to get the class of

ancestor

(integer(1))
If greater than 0 then the given ancestor to get the class for, see examples

...

ANY
Objects to vapply over

objects

(list(1))
Alternative constructor with list of objects

Details

object_classes is a stripped-down wrapper to get the class of multiple objects

Examples

library(R6)

class_a <- R6Class("class_a")
class_b <- R6Class("class_b", inherit = class_a)
class(class_b$new())
object_class(class_b$new())
object_class(class_b$new(), 1)

[Package ooplah version 0.2.0 Index]