object_class: Get class of an object (possibly with inheritance)

Description Usage Arguments Details Examples

View source: R/object_class.R

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

1
2
3
4
5
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

1
2
3
4
5
6
7
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)

ooplah documentation built on Jan. 21, 2022, 5:07 p.m.