View source: R/getObjectClassKind.R
getObjectClassKind | R Documentation |
Get the class kind of an R object as a string.
getObjectClassKind(object_o_1)
object_o_1 |
the |
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.
Fabien Gelineau <neonira@gmail.com>
Maintainer: Fabien Gelineau <neonira@gmail.com>
##---- 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.