setRefClass
setRefClass is a function in the R programming language used for defining reference classes. Reference classes, also known as S4 classes with mutable fields, provide an object-oriented programming paradigm that allows for the creation of objects whose internal state can be modified after creation. This differs from traditional R objects, which are typically immutable.
When defining a reference class using setRefClass, developers specify the fields (attributes) that instances of the
A key characteristic of reference classes is that they are passed by reference. This means that when
setRefClass is part of the R.methodsS3 package, which aims to provide a more object-oriented approach to R