reference-class Questions
2
Solved
Is it possible to get the syntax
foo$bar(x) <- value
to work where foo is a reference class object and bar is a method?
I.e. is it possible to do "subset assigment" and have "replacement func...
Avilla asked 15/1, 2019 at 20:56
3
Solved
Is it possible to have private member fields inside of an R reference class. Playing with some of the online examples I have:
> Account <- setRefClass( "ref_Account"
> , fields = list(
&g...
Zambrano asked 16/11, 2011 at 21:57
2
Solved
I can't find much on virtual/abstract classes in help(ReferenceClasses) - can anyone provide a basic example in creating one? Moreover, how can I specify a virtual method and enforce that child cla...
Bitterweed asked 15/1, 2014 at 16:24
2
Solved
I'm wondering if its possible to suppress these outputs in R which are cluttering up the console:
Note: no visible binding for global variable '.->ConfigString'
Note: no visible binding for '&...
Warlord asked 5/5, 2014 at 14:43
2
Solved
I would like to pass a reference class to a reference class constructor, and assign the passed reference class as a field. However, when I run the code below, I don't understand why I get an error....
Louannlouanna asked 31/10, 2012 at 19:14
1
Solved
I am looking for the equivalent of python's 'self' keyword or java's 'this' keyword in R. In the following example I am making an S4 object from a method of a different S4 object and need to pass a...
Contemplation asked 19/7, 2016 at 0:49
1
Solved
I have a ggplot2 plotting function as part of my code.
The function works fine when the file is sourced as R code, however when I include this function in an R package (and of course I include ggpl...
Alysa asked 15/5, 2015 at 18:49
3
Solved
I am currently writing a package using reference classes. I have come across
an issue which from reading various sources:
Method initialisation in R reference classes
Can't reliably use RefClass...
Vestavestal asked 22/9, 2012 at 11:1
1
Solved
For instance, say I have the following package called Test and I want to export class A:
# In /R/Test.R:
#' @docType package
#' @import methods
#' @exportClass A
A <- setRefClass("A", methods =...
Hexa asked 3/2, 2014 at 16:21
1
I have a list of fairly large objects that I want to apply a complicated function to in parallel, but my current method uses too much memory. I thought Reference Classes might help, but using mcapp...
Little asked 6/12, 2013 at 18:12
2
Solved
I would like to use a custom reference class inside another reference class, but this code fails:
nameClass <- setRefClass("nameClass", fields = list(first = "character",
last = "character"),...
Miraflores asked 19/9, 2013 at 11:23
1
Solved
I'm a huge fan of S4 Reference Classes as they allow for a hybrid programming style (functional/pass-by-value vs. oop/pass-by-reference; example) and thus increase flexibility dramatically.
Howeve...
Regent asked 20/3, 2013 at 16:27
1
I'm attempting to generate reference classes within an R package on the fly, and it's proving to be fairly difficult. Here are the approaches I've taken and problems I've run into:
I'm creating a ...
Stylography asked 23/4, 2013 at 15:43
2
Solved
Unfortunately things like (f+g)(3) where f and g are both unary functions do not work in R. Hence I tried to overload the "+" operator for unary functions in the following way:
"+.function" = func...
Cashbox asked 15/3, 2013 at 12:17
1
Solved
How can I define the fields' default values of S4 Reference Classes instances?
For regular S4 Classes, there's the prototype argument:
setClass("Test_1",
representation(
x.1="numeric",
x.2="l...
Mandolin asked 22/11, 2012 at 16:45
1
Solved
I am trying to create a simple reference class in R. Here is my code (R beginner):
MyClass <- setRefClass("MyClass",
fields = list(a = "numeric",
b = "numeric"),
methods = list(
initialize...
Plafond asked 21/7, 2012 at 22:9
1
Solved
Currently, I'm reading a lot about Software Engineering, Software Design, Design Patterns etc. Coming from a totally different background, that's all new fascinating stuff to me, so please bear wit...
Gosport asked 12/3, 2012 at 20:6
1
I've noticed some strange behaviour in R reference classes when trying to implement some optimisation algorithm. There seems to be some behind-the-scenes parsing magic involved in initialising meth...
Chafe asked 7/9, 2011 at 9:25
2
Solved
how do I document the use of member functions of a reference class?
if I write a Rd file with a \usage block, how do I avoid the WARNING
Functions/methods with usage in documentation object 'XmlD...
Urinate asked 20/7, 2011 at 8:27
3
Solved
While experimenting with the new reference classes in R I noticed some odd behaviour if you use the "[[ ]]" notation for methods (X[["doSomething"]] instead of X$doSomething). This notation works f...
Atomic asked 30/4, 2011 at 11:5
1
Solved
I'm working with a reference class with a few dozen fields. I've set up an initialize()method that takes a list object in. While some of the fields rely on further computation from list elements, m...
Dirt asked 13/4, 2011 at 19:44
1
Solved
Apparently John Chambers added Reference Classes to R in version 2.12. There doesn't appear to be much information online yet, but they're calling them R5 classes, which implies they're on a level ...
Anergy asked 28/2, 2011 at 0:47
1
© 2022 - 2024 — McMap. All rights reserved.