Displaying 1 result from an estimated 1 matches for "modb2".
Did you mean:
mod2
2013 May 18
1
Copy on assignment to large field of reference class
...large fields in reference
classes.
As the code below shows assignment via <<- causes many copies to be made if
the subsetting is extensive (in modb1). This can cause R to run out of
memory. Creating a local copy and using the optimisation in <- is the best
solution I have found so far (in modb2) - but it is not really much better
than ordinary functions using call by value and then reassigning.
Is there a reason why optimisation does not occur for <<- ? Or is their a
better solution for reference classes?
Regards
Giles
A <- setRefClass("A", fields=list(b="vector...