search for: refclasses

Displaying 17 results from an estimated 17 matches for "refclasses".

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 --
2011 Oct 07
0
Pb building sets of S4 / RefClass objects with package "sets"
Hi, does anyone know if it is possible to construct sets of S4 objects? It seems the constructor set does not like it: Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character' Regards Johnny [[alternative HTML version deleted]]
2011 Oct 07
1
Pb building sets of S4 / RefClass objects with package "sets"
Hi, does anyone know if it is possible to construct sets of S4 objects? It seems the constructor set does not like it: Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character' Regards Johnny PS: by the way, does anyone know where I can find some examples using the cset class from the "sets" package, beside 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 c...
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
2011 Mar 10
1
Testing for a reference class object
Hi all, I've constructed the following function to test whether or not an object was created from a reference class: isRefClassObject <- function(x) isS4(x) && is.environment(attr(x,'.xData')) && exists('.refClassDef',attr(x,'.xData')) but I'm unsure if it's a complete test or if there's a better way to test. Regardless, It would be
2015 Sep 29
1
making object.size() more meaningful on environments?
Hi Gabe, On 09/29/2015 02:51 PM, Gabriel Becker wrote: > Herve, > > The problem then would be that for A a refClass whose fields take up N > bytes (in the sense that you mean), if we do > > B <- A > > A and B would look like the BOTH take up N bytes, for a total of 2N, > whereas AFAIK R would only be using ~ N + 2*56 bytes, right? Yes, but that's still a *much*
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:
2015 Jun 23
3
Plans to improve reference classes?
Could of requests: 1) Is there any example or writeup on the difficulties of extending reference classes across packages? Just so I can fully understand the issues. 2) In what sorts of situations does the performance of reference classes cause problems? Sure, it's an order of magnitude slower than constructing a simple environment, but those timings are in microseconds, so one would need a
2015 Sep 29
3
making object.size() more meaningful on environments?
Hi, Currently object.size() is not very useful on environments as it always returns 56 bytes, no matter how big the environment is: env1 <- new.env() object.size(env1) # 56 bytes env2 <- new.env(hash=TRUE, size=75000000L) object.size(env2) # 56 bytes env3 <- list2env(list(a=runif(25000000), L=LETTERS)) object.size(env3) # 56 bytes This makes it pretty useless on
2015 Jul 03
1
Are downstream dependencies rebuilt when a package is updated on CRAN?
I was wondering: are the downstream dependencies of a package rebuilt when a package is updated on CRAN? (I'm referring to the binary packages, of course.) The reason I ask is because there are cases where this can cause problems. Suppose that when pkgB is built, it calls pkgA::makeClosure(), which returns a closure that refers to a function in pkgA. Suppose this code is in pkgA 1.0:
2015 Jun 23
0
Plans to improve reference classes?
...#39;s an order of magnitude slower than > constructing a simple environment, but those timings are in > microseconds, so one would need a thousand objects before it started > to be noticeable. Some motivating use cases would help. It's a bit of a pathological case, but the switch from RefClasses to R6 made a noticeable performance improvement in shiny. It's hard to quantify the impact on an app, but the impact on the underlying reactive implementation was quite profound: http://rpubs.com/wch/27260 vs http://rpubs.com/wch/27264 R6 also includes a vignette with detailed benchmarking: h...
2015 Sep 29
0
making object.size() more meaningful on environments?
Herve, The problem then would be that for A a refClass whose fields take up N bytes (in the sense that you mean), if we do B <- A A and B would look like the BOTH take up N bytes, for a total of 2N, whereas AFAIK R would only be using ~ N + 2*56 bytes, right? ~G On Tue, Sep 29, 2015 at 2:42 PM, Herv? Pag?s <hpages at fredhutch.org> wrote: > Hi, > > Currently object.size()
2011 Apr 24
0
should I use setRefClass() ?
Hello, I am somewhat new to R programming and a novice C++ programmer. I'd like to know if I should use setRefClass() to manage objects, functions, and data in a very large program I am attempting to code. See: http://stat.ethz.ch/R-manual/R-devel/library/methods/html/refClass.html I like the referential class structure that C++ provides and R seems to provides via setRefClass(). Mainly
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 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
2015 Jan 26
2
speedbump in library
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Mon, 26 Jan 2015 05:12:55 -0800 writes: > A isNamespaceLoaded() function would be a useful thing to > have in general if we are interested in readable code. An > efficient implementation would be just a bonus. Good point (readability), and thank you for the support! Note