[R] assign value to slot of S4 object

Ross Ihaka ihaka at stat.auckland.ac.nz
Wed Feb 19 08:05:04 CET 2003


Laurent Gautier wrote:
> Dear list,
> 
> I noticed something while assigning a new value to the slot
> of an object of class S4.
> Apparently(*) this object is copied while the operation
> is performed. Is it really wished ?  (or did I miss something ?)
> 
> I use R-1.6.2:

This is a product of the S call-by-value semantics.  There is actually 
an enormous amount of copying which takes place in R (and Splus). 
However, it is only with large objects that this becomes noticable.

Coincidentally John Chambers, Robert Gentleman, Paul Murrell and I were 
discussing exactly this type of issue today.  We are certainly aware 
that there are problems and are looking at potential solutions.

-- 
Ross Ihaka                         Email:  ihaka at stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 85054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand




More information about the R-help mailing list