Description Usage Arguments Value Author(s) Examples
View source: R/getObjectClassKind.R
Get the class kind of an R object as a string.
1 | getObjectClassKind(object_o_1)
|
object_o_1 |
the object to analyze. See |
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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ##---- 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.