Dear list, I don't know what's the correct term for this in the OOP context, but is it possible to "clone"/copy an instance of a reference class (say 'a') so that I get an *autonomous* second instance 'b'? Autonomous in the sense that changes to 'a' do not affect 'b'. I know that this is somewhat against the pass-by-reference paradigm, but the motive behind this is to generalize the 'undo()' functionality described in the example of 'setRefClass()' to entire objects: I'd like to generate "images" of my object via a '$imageAdd()" method in order to generate a change history of the object (images are assigned to a field '.IMAGES' of class 'environment') that I can "load()" on demand to undo changes to my object. Obviously, simply assigning 'b <- a' does not work with respect to autonomy. Nor does exporting the object via 'b <- a$export(Class="A")'. I thought about creating a new instance b and then defining a function that maps the field values from a to b: b <- getRefClass("A")$new() fieldsMap(src=a, tgt=b) Is there already some functionality I can use? Thanks, Janko ########## SYSTEM INFO ########## Windows XP SP3 R 2.12.0 (patched as of 2010-11-22) Eclipse 3.6.1 (Helios) StatET 0.9.x ###############################
Hi there, I want to do a nonparametric covariance analysis and I have tried to use the package "sm" function "sm.ancova" but it didn't work for me because I have more then one covariates (I have 18 covariates and 3 factors). I want to analyse for one factor (who has 13 levels) where the differences for my response are, using the explanatory (covariates). (The other two factors are: Temperature and force needed). I mean, I want to create groups for the levels of the factor, where within each group no significant difference exist. My residuals haven't normal distribution and aren't homoscedastic. I have tried already the boxcox transformation and glm procedures, but whitout success. So I am looking for these methos for nonparametrics analysis of covariance. Thanks for any help. -- Daniela Rodrigues Recchia Master Student of Statistics - Technische Universität Dortmund. "Like dreams, statistics are a form of wish fulfillment." Jean Baudrillard. [[alternative HTML version deleted]]
No reference class method explicitly does this, but it's a natural utility. Some form of $copy() will be added. It needs a shallow/deep option; i.e., if a field is itself a reference class object, should that field be cloned as well. The full reflectance available should make a single method (for the "envRefClass") work generally, although classes with non-standard accessor functions may need to have their own method. Any contributions or suggestions are welcome, particularly with respect to features from other OOP languages that should be accommodated. Lazy copy would be attractive, but harder to implement. John On 11/24/10 1:47 AM, Janko Thyson wrote:> Dear list, > > I don't know what's the correct term for this in the OOP context, but is it > possible to "clone"/copy an instance of a reference class (say 'a') so that > I get an *autonomous* second instance 'b'? Autonomous in the sense that > changes to 'a' do not affect 'b'. > > I know that this is somewhat against the pass-by-reference paradigm, but the > motive behind this is to generalize the 'undo()' functionality described in > the example of 'setRefClass()' to entire objects: I'd like to generate > "images" of my object via a '$imageAdd()" method in order to generate a > change history of the object (images are assigned to a field '.IMAGES' of > class 'environment') that I can "load()" on demand to undo changes to my > object. > > Obviously, simply assigning 'b<- a' does not work with respect to autonomy. > Nor does exporting the object via 'b<- a$export(Class="A")'. > I thought about creating a new instance b and then defining a function that > maps the field values from a to b: > > b<- getRefClass("A")$new() > fieldsMap(src=a, tgt=b) > > Is there already some functionality I can use? > > Thanks, > Janko > > ########## SYSTEM INFO ########## > Windows XP SP3 > R 2.12.0 (patched as of 2010-11-22) > Eclipse 3.6.1 (Helios) > StatET 0.9.x > ############################### > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Maybe Matching Threads
- Reference Classes: removing methods -> implications for objects/instances of that class
- Reference classes: accessor functions via 'getRefClass(...)$accessors(...)'
- How can I write methods for 'as()'?
- WG: Reference classes: error with missing arguments in method calls
- Ref Classes: bug with using '.self' within initialize methods?