Description Usage Arguments Details Value
Fetch all necessary information to construct a reference class generator function.
Reference class objects are the closest approximation of the concepts of object-oriented programming available in R. While S3 and S4 classes serve the useful purpose of providing dispatching mechanisms on generic functions, reference classes allow for mutability of data on the underlying object regardless of calling convention (or nasty syntax like replace methods).
1 2 3 4 | ref_class_information(Class, contains, fields, refMethods, where)
setRefClass(Class, fields = character(), contains = character(),
methods = list(), where = topenv(parent.frame()), ...)
|
refMethods |
list. A named list of reference class methods. |
Class |
character. The name of the newly created reference class. |
fields |
character. The field for the reference class. Fields are
equivalent to "members" in other languages, and can represent any data.
In this particular case, the convention is something like
|
contains |
character. The parent reference classes of this reference
class. The default is |
methods |
list. The methods for instances of this reference class.
In particular, the names of this list represent the names of the methods,
and the values must be functions. For example,
|
where |
environment. Where to store the definition of the reference
class. The default is |
... |
additional arguments to the |
# TODO: (RK) More description here.
the fully formed reference class object generator. For example,
if we call x <- setRefClass(...)
, then we can call x$new(...)
to invoke the constructor for the object x
. The class of the
reference class object generator is "refObjectGenerator"
.
# TODO: (RK) More documentation and examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.