The R6 package provides a type of class which is similar to R’s standard reference classes, but it is more efficient and doesn’t depend on S4 classes and the methods package
Questions tagged [r6]
181 questions
0
votes
1 answer
Update a dependent field in R6 object when a parent field is updated
I'm new to R6 and object oriented programming, so i'm not sure the right way to even talk about dependencies between fields inside an object.
My objects have fields that are dependent on other fields inside the object. I would like those dependent…

ricardo
- 8,195
- 7
- 47
- 69
0
votes
1 answer
Different results even with set.seed() in R
I have re-run with the same seed but cannot produce same results in R studio.
Will set.seed() lose track when calling different user packages, R6 classes and methods?
Have you come across similar situation and how to fix it?
Thanks a…

waith
- 21
- 1
- 3
0
votes
0 answers
R parallel processing with multiple outputs in R6 class setting
I want to run some function in parallel that have effectively two outputs. I am fully aware that R function can only return one variable at a time. My problem is set in a R6 class, where I run a parallel loop using parLapply calling R6 class methods…

ak17
- 167
- 1
- 9
0
votes
1 answer
Problems with loading R6 object - R breaks
I have a complex R6 object that gives me problems with R when I save and load it again. If I save it with saveRDS and loads it into another R session with readRDS, R starts printing random stuff to the console. E.g. after a load, I get something…
0
votes
1 answer
Arithmetic operators overload for R6classes in R
I am working on a custom R6Class which will be the main structure of my R package. But the problem is that this:
setMethod('+', signature("MyClass"), function(e1, e2)1)
or
setMethod('+', signature("R6"), function(e1, e2)1)
are not working because…

Leonardo Lanchas
- 1,616
- 1
- 15
- 37
0
votes
1 answer
Use rcpp function inside R6 class
Is there a way to use an Rcpp function inside an R6 class while developing a package?
Example:
I have a add.cpp in the /src folder of my package as follows
#include
using namespace Rcpp;
//
//' Add two numbers
//'
//' @param x An…

Gompu
- 415
- 1
- 6
- 21
0
votes
1 answer
R6Class bug __Deferred_Default_Marker__
I'm implementing a new R6Class and trying to add new members dynamically (https://cran.r-project.org/web/packages/R6/vignettes/Introduction.html#adding-members-to-an-existing-class) but I get this error "__Deferred_Default_Marker__" (whether it be…

Leonardo Lanchas
- 1,616
- 1
- 15
- 37
0
votes
1 answer
Using memoise in R6 objects
All,
I am new to R6.
I am trying to create a private object which is cached via the memoise function. The background idea is that this object will be defined by a computationally intensive calculation, which I would like to avoid rerunning after…

T.Holme
- 473
- 4
- 17
0
votes
1 answer
How to look up an R6 object attribute by character vector
I have the following class which begins as follows:
dataSeries <- R6Class("dataSeries",
public = list(
geoAccession = NULL,
species = NULL,
tissue = NULL,
…

mkk
- 879
- 6
- 19
0
votes
1 answer
Moving source code to a separate file changes the value returned by a method
I am writing a class definition that will be extremely long, and I'd like to source the code for the methods from separate files. Most of the time, that seems to work, but I have encountered something strange when trying to return a data.frame. …

Paul de Barros
- 1,170
- 8
- 22
0
votes
1 answer
R6 Function in Function
library(R6)
pre <- R6Class("pre",
public = list(
dbl = NULL,
initialize = function(){},
functionA = function(){},
functionB = function() {}
) )
Here is the code I want:
FunctionA ()
{
FunctionB ()
}
But there is an error here.
Error:…

조석현
- 1
0
votes
1 answer
Converting from a super class to an inherited class in R6
Lets say I have
library(R6)
Person <- R6Class("Person",
public = list(
name = NULL,
hair = NULL,
initialize = function(name = NA, hair = NA) {
self$name <- name
…

Lily
- 65
- 6
0
votes
1 answer
R6 store methods by reference instead of copy
I'm creating multiple R6 objects of the same class, my cl class contains some heavy methods.
As my understanding - code below - it seems that each of object has it's own copy of all methods.
How can I have single copy of methods for all my cl…

jangorecki
- 16,384
- 4
- 79
- 160
0
votes
1 answer
Add methods to an R6 subclass
I started tinkering with R6 for a project at work and I can't understand the following behavior.
Let's say I define a superclass Person and a subclass PersonWithAge :
Person <- R6Class("Person",
public = list(
…

Tutuchan
- 1,527
- 10
- 19
-2
votes
1 answer
Roxygen2: "Error in loadNamespace(name) : there is no package called ‘testthat’"?
This is a follow up from a previous question.
How to integrate new R6Class functions stored in independent files into an existing R package?
In summary, in trying to load a function stored in a file. I managed to do it by altering manually the…

John Gil
- 51
- 3
- 8