| getObjectClassKind {wyz.code.offensiveProgramming} | R Documentation |
Get R object class kind
Description
Get the class kind of an R object as a string.
Usage
getObjectClassKind(object_o_1)
Arguments
object_o_1 |
the |
Value
A single character value, taken in set "S3",
"S4",
"RC", "R6", "environment",
"unknown".
When provided object_ is not an R object, then value
NA_character_ is returned.
Author(s)
Fabien Gelineau <neonira@gmail.com>
Maintainer: Fabien Gelineau <neonira@gmail.com>
Examples
##---- typical case ----
getObjectClassKind(new.env())
# [1] NA
myrc <- setRefClass("RC",
fields = list(x = "numeric"),
methods = list(
initialize = function(x = 1) .self$x <- x,
getx = function() x,
inc = function(n = 1) x <<- x + n
)
)
getObjectClassKind(myrc$new())
# [1] RC
myr6 <- R6::R6Class("R6",
public = list(
x = NULL,
initialize = function(x = 1) self$x <- x,
getx = function() self$x,
inc = function(n = 1) self$x <- x + n
)
)
getObjectClassKind(myr6$new())
# [1] R6
[Package wyz.code.offensiveProgramming version 1.1.24 Index]