Re: [Rd] Copy on assignment to large field of reference class

2013-05-19 Thread John Chambers
This is a useful observation. To talk about it, though, we need to re-express it in terms that make sense for R; there are too many misconceptions otherwise. The basic observation is this: When simple subset or element replacement is done in a loop, normally the object is only copied on the fi

[Rd] Copy on assignment to large field of reference class

2013-05-19 Thread Giles Percy
Dear all I am trying to find the best way to handle 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 <-