search for: referenceclass

Displaying 20 results from an estimated 22 matches for "referenceclass".

Did you mean: referenceclasses
2011 Jan 28
1
ReferenceClasses examples {method}
Dear help, dear John Chambers, I'm trying to learn OOP-possibilities in R and I was going through the documentation 'ReferenceClasses {methods}'. (great work, by the way...) Reading associated Examples, something bothers me : it seems to me that there are errors in 'edit' and 'undo' methods. I think that : - 'undo' should update 'edits' field with : length(edits) <<- length(edits) - 1...
2011 Jan 28
1
ReferenceClasses examples {method}
Dear r-devel-list, dear John Chambers, I'm trying to learn OOP-possibilities in R and I was going through the documentation 'ReferenceClasses {methods}' (great work, by the way...). Reading associated Examples, something bothers me : it seems to me that there are errors in 'edit' and 'undo' methods. I think that : - 'undo' should update 'edits' field with : length(edits) <<- length(edits) - 1...
2012 Oct 27
2
Class generator functions for reference classes
...tyle is now: mEdit <- setRefClass("mEdit",......) xx <- mEdit(data = xMat) instead of xx <- mEdit$new(data = xMat) The returned object still has fields and methods accessible as before. See the "Value" and "Reference Class Generators" sections of ?ReferenceClasses for details. Thanks to Romain Fran?ois for suggesting this. John
2011 Jun 04
2
Interfacing a C++ class
...e assignments. The getters and setters ("$", "[") are set up and work. Each modification goes in hand with assigning new values to bar as well as updating the FOO object through available setters from FOO. So far, this way has brought me to about 100 lines, but now I read about ReferenceClasses and was wondering, if there is a much easier way of achieving my goals. Moreover, I was not sure any longer if my goals make sense or if a more advanced programmer would do it totally different (and could share some structural thinking on their approach). The idea behind my way of doing was base...
2011 Apr 07
2
How to debug reference classes?
How do you debug methods of a reference class? I've been using mtrace, which is excellent, but i cannot figure out how to mtrace a reference class method. Maybe there is some other way to debug these, for example with ordinary trace? for now i am only able to use options(error=recover), which is not giving me idea where exactly in the code i am once i am stopped on an error. -- View this
2011 Mar 07
1
WG: Reference classes: error with missing arguments in method calls
...g (r-devel at r-project.org) Betreff: Reference classes: error with missing arguments in method calls Dear list, I?m having problems in understanding an error that pops up in the context of missing arguments with methods of reference class objects. Because of the following statement taken from ??referenceClass?, my ref class methods call explicit S4 methods: ?Reference methods should be kept simple; if they need to do some specialized R computation, that computation should use a separate R function that is called from the reference method? So a ref class would look like this: setRefClass(Class="Xmp...
2011 Dec 30
0
testthat 0.6
...hellesoy/cucumber/). I have used what I think works for R, and abandoned what doesn't, creating a testing environment that is philosophically centred in R. Version 0.6 ------------------------------------------------------------------------------ * All `mutatr` classes have been replaced with ReferenceClasses. * Better documentation for short-hand expectations. * `test_dir` and `test_package` gain new `filter` argument which allows you to restrict which tests are run. -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ___________...
2011 Dec 30
0
testthat 0.6
...hellesoy/cucumber/). I have used what I think works for R, and abandoned what doesn't, creating a testing environment that is philosophically centred in R. Version 0.6 ------------------------------------------------------------------------------ * All `mutatr` classes have been replaced with ReferenceClasses. * Better documentation for short-hand expectations. * `test_dir` and `test_package` gain new `filter` argument which allows you to restrict which tests are run. -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ___________...
2011 Jun 06
1
Reference Classes: shortcut like 'isS4' for Ref Classes?
Dear list, is there a shortcut-function to check whether a class is a Reference Class or not? There's something like this for S4 classes ('isS4(object)'), but I couldn't find anything regarding Ref Classes. Currently, I'm doing it this way, which is a bit clumsy: A <- setRefClass("A", fields=list(X="numeric")) a <- A$new() isRefClass <-
2012 May 15
1
Object-oriented programming (OOP)
Hello everybody, please excuse my bad English. I am Alfredo Naime and I'm from to Venezuela. I want to make a lib with tools for simulation (queues, inventories, factory, etc.) using object-oriented programming (OOP). You have any manuals on the handling of data types, classes, inheritance, etc. in R with examples and how to make a R lib. Thank you, very much. Alfredo
2011 Jun 03
2
S4 Slot assignment within function
Is there a simple way to assign values to S4 slots from within a function? Doing this doesn't work: > assign_slot<-function(x){ assign("OBJECT at slot",x,envir=parent.env(environment()) } >assign_slot(x) All I get from this is a new object with the name OBJECT at slot, the slot assignment of OBJECT doesn't change. I have thought about solutions such as
2012 Feb 21
1
Private Variables in R5-Classes possible?
Hi list, is there a way to define some kind of private Variable? I would like to prevent the user from manipulating fields on his own, in order to not destroy data structures. The problem is, that as soon as the variable exists in the environment it is accessible via t$secret_value. test <- setRefClass("test", fields=list( secret = function(value){ cat("the function was
2011 Apr 06
2
S4 generic functions/methods vs enclosures
Apologies for asking something that is probably very obvious, i just started with S4 classes and i guess i am not finding documentation that lays out the grammar rules and gives enough examples. I understand that main method of writing a member function is to write a generic function and setMethod for this particular class. This, however, presumes that there is "virtuality" for this
2011 Feb 20
0
Reference classes: error with missing arguments in method calls
Dear list, I'm having problems in understanding an error that pops up in the context of missing arguments with methods of reference class objects. Because of the following statement taken from '?referenceClass', my ref class methods call explicit S4 methods: "Reference methods should be kept simple; if they need to do some specialized R computation, that computation should use a separate R function that is called from the reference method" So a ref class would look like this: setRefCl...
2013 Mar 01
1
S4-classes: Assignment of values to slots by reference
Dear R-users, I am working on a project that uses S4-classes. At some point I encountered the problem - well known to R - that I have to pass 3 different objects to a function, that should modify several slots of them and of course there is no passing by reference in R. Then I read this thread by Steve Lianoglou: https://stat.ethz.ch/pipermail/r-help/2010-August/250468.html, which offers from
2010 Oct 23
1
Plans for tighter integration of reference classes in R.
Hello Everyone! Here are a couple of thought/questions on refClasses integration in R core functionality. First, coexistence with S4: > X <- setRefClass("classX", fields = c("a", "b"), + representation = list(c = "character")) > x <- X$new() > x at c <- "sss" > x An object of class "classX"
2011 Apr 05
1
super basic questions about S4 classes
Apologies for asking something that is probably super obvious, i just started with S4 classes and i guess i am not finding documentation that layout the grammar rules and give enough examples. Some questions i am having are these 1. I understand that main method of writing a member function is to write a generic function and setMethod for this particular object. This, however, presumes that there
2010 Oct 15
0
R 2.12.0 is released
...able on all builds of R. ? Sys.which() has been altered to return "" if the command is not found (even on Solaris). ? A facility for defining reference-based S4 classes (in the OOP style of Java, C++, etc.) has been added experimentally to package methods; see ?ReferenceClasses. ? The predict method for "loess" fits gains an na.action argument which defaults to na.pass rather than the previous default of na.omit. Predictions from "loess" fits are now named from the row names of newdata. ? Parsing errors detected dur...
2010 Oct 15
0
R 2.12.0 is released
...able on all builds of R. ? Sys.which() has been altered to return "" if the command is not found (even on Solaris). ? A facility for defining reference-based S4 classes (in the OOP style of Java, C++, etc.) has been added experimentally to package methods; see ?ReferenceClasses. ? The predict method for "loess" fits gains an na.action argument which defaults to na.pass rather than the previous default of na.omit. Predictions from "loess" fits are now named from the row names of newdata. ? Parsing errors detected dur...
2012 Jul 17
3
complexity of operations in R
Hello! I am optimizing my code in R and for this I need to know a bit more about the internals. It would help tremendously if someone could link me to a page with O()-complexities of all the operations. In this particular case, I need something like a linked list with O(1) insertLast/First ability. I can't preallocate a vector since I do not know the final size of the list ahead of time. The