Displaying 20 results from an estimated 10000 matches similar to: "initFields() method no longer coerces arguments in R-devel"
2011 May 04
1
General "nil" reference class object
Dear John and others,
I've been wondering about whether there's any way to indicate a "nil"
reference class object, which will represent "no value", and be tested
for, but not fail the internal type checking. NULL is the obvious
choice (or seems so to me), but can only be used if an explicit class
union is created:
> Foo <- setRefClass("Foo")
> Bar
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
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 =
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 =
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
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]]
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.
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 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",
2010 Nov 17
2
Reference classes: accessor functions via 'getRefClass(...)$accessors(...)'
Hi there,
I''d like to choose between an "static" and "dynamic" access of a reference
class field, say ''a''.
myObj <- getRefClass("Blabla")$new()
Static: myObj$a
Dynamic: myObj$a.get() where the function retrieves the data
from a database (or some other location), stores it to a buffer and
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,
2011 Mar 07
1
WG: Reference classes: error with missing arguments in method calls
Dear list,
a while ago I posted this at r-devel but got no answers. Hope it?s okay to
give it a shot again by cross-posting it here.
TIA for any comments,
Janko
Von: Janko Thyson [mailto:janko.thyson.rstuff at googlemail.com]
Gesendet: Montag, 21. Februar 2011 00:58
An: r-devel at r-project. org (r-devel at r-project.org)
Betreff: Reference classes: error with missing arguments in method calls
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
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