similar to: should I use setRefClass() ?

Displaying 20 results from an estimated 10000 matches similar to: "should I use setRefClass() ?"

2013 May 01
1
Size of a refClass instance
I'm using refClass for a complex multi-directional tree structure with possibly 100,000s of nodes. The refClass design is very impressive and I'd love to use it, but I've found that the size of refClass instances are very large and creation time is slow. For example, below is a RefClass and normal S4 class. The RefClass requires about 4KB per instance vs 500B for the S4 class --
2012 Apr 13
0
Reference Class import() behaviour
Dear All, In a project I've been working on we've been using Reference Classes and grid extensively. However, something that I have come across is that when using the import() method on refclass objects, it does not work as expected with grid grobs and viewports. I have prepared test cases that illustrate the point but the general idea is that importing appears to work fine for
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.
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 Sep 24
1
Can't reliably use RefClass methods in Snowfall
Greetings, I am trying to use Reference Class methods in Snowfall, using R 2.12.1 on Ubuntu Natty. Using then directly seems to work (stanza 2 below), but using them indirectly does not (stanza 3 below). I get an "attempt to apply non-function" error. In addition to exporting the instance of the object I created to the Snowfall slaves, I also made several attempts to export the
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"
2013 Oct 16
1
Internally accessing ref class methods with .self$x is different from .self[['x']]
When a reference class method is accessed with .self$x, it has different behavior from .self[['x']]. The former copies the function to the object's environment (with some attributes attached), and the latter just return NULL (unless it has already been accessed once with .self$x). Is this how it's supposed to work? Here's an example that illustrates:
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 <-
2006 May 25
5
[OT] Rails hosting question -- video centric
This is OT in the sense that it''s yet another hosting question and not strictly a problem I''m having with Rails. Basically, I trust and appreciate the knowledge of the folks on this list so I''m hoping for some insight. I have a new project that I''ll be starting up soon. It''s basically going to feed videos. The webapp piece is trivial. I''m
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",
2015 Jun 23
0
Plans to improve reference classes?
> 1) Is there any example or writeup on the difficulties of extending > reference classes across packages? Just so I can fully understand the > issues. Here's a simple example: library(scales) library(methods) MyRange <- setRefClass("MyRange", contains = "DiscreteRange") a_range <- MyRange() a_range$train(1:10) # Error in a_range$train(1:10) : could not
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
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 =
2005 Jul 01
0
Unix Network Admin - Orlando, Florida, USA
Global Technology Associates, Inc. (http://www.gta.com) is looking for a network system admin with Unix experience, (see the requirements below). GTA is a small privately held corporation founded in 1992 and located in Orlando, Florida, USA. We're FreeBSD-centric and have funded, contributed and been involved in the BSD community since the company's inception. Our work environment is
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,
2008 Sep 26
0
self-referential tags, has_many_polymorphs
Hi, I''m looking to add tagging to an application, and I would like to allow self-referential tags, so that I can tag my tags. With the goal of generating a flexible tag hierarchy. After some googling it looks like acts_as_taggable is not the best piece of code, and I''m hoping to use the has_many_polymorphs plugin from http://github.com/fauna/has_many_polymorphs/tree/master.
2013 Jun 14
0
Support for deferrable constraints in PostgreSQLAdapter#disable_referential_integrity
I recently submitted a pull-request (https://github.com/rails/rails/pull/10939) to address a bug in PostgreSQLAdapter#disable_referential_integrity related to how the existing code behaves in a transaction when the PostgreSQL user account lacks superuser privileges on the PostgreSQL instance. While this permits the code to function without crashing, it doesn''t actually make
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