similar to: General "nil" reference class object

Displaying 20 results from an estimated 500 matches similar to: "General "nil" reference class object"

2011 Aug 05
1
initFields() method no longer coerces arguments in R-devel
Dear all, I've just had a package update bounced from CRAN because of a recent change in R-devel which seems to affect the behaviour of the initFields() reference class method. (The change must be very recent because I tested the package on a week-old build of R-devel.) It seems that the method no longer coerces its arguments to the expected type of each field. For a simple example: > Foo
2011 Jun 01
1
possibly invalid assertion in setRefClass?
> setRefClass("Foo", fields = list()) Error in setRefClass("Foo", fields = list()) : A list argument for fields must have nonempty names for all the fields In my opinion, the above should not fail. There are no fields. Thanks, Michael [[alternative HTML version deleted]]
2011 Oct 31
1
Question about copying reference objects using the initialize method
Dears, I have a question about copying reference objects using the initialize method. 1) If the latter has no arguments, there is no problem to copy an object. myClass = setRefClass("myClass", fields = list(value = "numeric") ) myClass$methods(initialize = function(...){ ? value <<- 1 ? callSuper(...) }) newObject = myClass$new() newObject$value = 2 copyObject =
2012 Nov 08
1
Dabbling with R5 setRefClass - Inheritance problems
Hello, I wrote a class like so: > rcfdpsuperclass <- setRefClass( > Class="rcfdpsuperclass", > fields = list( > RcfpdVersion = "character"), > methods = list( > initialize = function(){ > 'Populates fields with defaults and lock as appropriate' > initFields( > RcfpdVersion =
2010 Oct 28
2
Reference Classes: Generalizing Reference Class Generator objects?
Is it possible to override the $new(...) in the reference class generator? I have tried adding a "new" method to the methods of the class, but that is obviously not correct. I have also tried adding it to the class generator, but the class generator still uses the default constructor. As a simple example, this is the current interface: TestClass <- setRefClass
2012 Jun 25
1
Very simple question R5 setRefClass and Initialize
Hi, New to this list, and glad I found R5 which si a great improvement to R for my work. Something seems odd anyway, when I do a setRefClass, the initialize method execute at the class definition. I would like it to execute only when an instance is created. How can I do that? I found no way to test if the code execution is when the class definition happens or when a $new instance is created.
2013 Mar 28
1
Ref classes initFields has incorrect environment?
As suggested by the following code: A <- setRefClass("A", fields = list(x = "logical"), methods = list(initialize = function(...) { x <<- FALSE initFields(...) })) A$new() # Works as expected quote <- as.character A$new() # Error in function (value) : # invalid replacement for field ?x?, should be from class ?logical? or a subclass (was class
2011 Dec 08
1
Reference class finalize() fails with 'attempt to apply non-function'
This bug appears intermittently in R CMD check when reference classes have finalize methods. The problem is that garbage collection can be run after the methods package is no longer available. It affects (periodically) the Bioconductor AnnotationDbi package as well as packages that contain Rcpp classes. To reproduce: library(methods) a = setRefClass("A",
2012 Oct 27
2
Class generator functions for reference classes
As of rev. 61035 in r-devel, setRefClass() now returns a generator function, as setClass() has done since 2.15.0. The convenient style 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
2010 Nov 21
1
reference classes: question on inheritance
Dear list, I have a reference class which should act as a "generic" superclass for other classes. I've read the respective section at ?setRefClass and put the name of the superclass to the 'contains' argument of an example subclass (see class defs below). Classnames are set in a way that shouldn't result in collation issues (virtual def sourced before superclass def
2014 Feb 11
2
$new cannot be accessed when running from Rscript and methods package is not loaded
Hi Accesses the $new method for a class defined in a package fails if the methods package is not loaded. I have created a test package with the following single code file: newTest <- function() { cl <- get("someClass") cl$new } someClass <- setRefClass("someClass") (This is similar to code actually used in the testthat package.) If methods is not loaded,
2010 Oct 22
1
Reference classes
Dear all, First, many thanks to John Chambers, and anyone else who was involved, for the new support for "reference classes" in R 2.12.0. It's nice to see this kind of functionality appear in a relatively R-like form, and with the blessing of the core team. In some contexts it is undoubtedly appealing to associate a set of methods with a class directly, rather than defining a load
2011 Jun 29
1
Ref Classes: bug with using '.self' within initialize methods?
Dear list, I'm wondering if the following error I'm getting is a small bug in the Reference Class paradigm or if it makes perfect sense. When you write an explicit initialize method for a Ref Class, can you then make use of '.self' WITHIN this initialize method just as you would once an object of the class has actually been initialized? Because it seems to me that you can not.
2011 Feb 03
2
Creating a reference class object from a class definition in a package fails
Hi, I'm trying to create a package that contains reference class definitions from which users can create reference objects, but there seems to be something awry. My toy example creates an empty package via package.skeleton('TestClass') to which I add the following R code: TestClass <- setRefClass('TestClass',fields=c('name')) Unfortunately my R console output
2011 Jun 03
2
Bug or feature: using "ANY" as a generic field class (was: '[R] Is there a (virtual) class that all R objects inherit from?)
Dear list, I was wondering if you could help me out in clarifying something: Is it possible to use class "ANY" in slots/fields of formal classes if you a) do not want to restrict valid classes of that field and b) if you are making explicit use of class inheritance? It seems to work in simple scenarios but produces errors when class inheritance comes into play. So I was
2012 Mar 13
2
Problem installing gWidgetsRGtk2 on Ubuntu 10.04
dear all, I'm totally new to R and want to install the RQDA package. It fails because of a dependency with gWidgetsRGtk2, which doesn't install because of the following: > * installing *source* package ?gWidgetsRGtk2? ... ** R ** inst ** preparing package for lazy loading Error in eval(expr, envir, enclos) : konnte Funktion "setRefClass" nicht finden (=could not find
2020 Mar 27
2
object.size vs lobstr::obj_size
On 3/27/20 12:00, Hadley Wickham wrote: > > > On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s <hpages at fredhutch.org > <mailto:hpages at fredhutch.org>> wrote: > > Hi Tomas, > > On 3/27/20 07:01, Tomas Kalibera wrote: > > they provide an over-approximation > > They can also provide an "under-approximation" (to say the
2020 Mar 27
4
object.size vs lobstr::obj_size
Hi Tomas, On 3/27/20 07:01, Tomas Kalibera wrote: > they provide an over-approximation They can also provide an "under-approximation" (to say the least) e.g. on reference objects where the entire substance of the object is ignored which makes object.size() completely meaningless in that case: setRefClass("A", fields=c(stuff="ANY"))
2012 Jan 04
1
Is there a way to update a method on an existing Reference Class object?
Hi Being able to do object oriented programming in R is really good. I now started using the Reference Classes and really like it. Though, I have one problem: I cannot find a way to update a method on an existing object. The flexibility that scripting gives (really needed for interactive data analysis) is lost if everything have to be recalculated all the time. For example I would normally
2020 Mar 27
1
object.size vs lobstr::obj_size
On 3/27/20 15:19, Hadley Wickham wrote: > > > On Fri, Mar 27, 2020 at 4:01 PM Herv? Pag?s <hpages at fredhutch.org > <mailto:hpages at fredhutch.org>> wrote: > > > > On 3/27/20 12:00, Hadley Wickham wrote: > > > > > > On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s > <hpages at fredhutch.org <mailto:hpages at