[R] Shared components?

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Jul 18 16:18:05 CEST 2002

On Thu, 18 Jul 2002, Duncan Murdoch wrote:

> >Date: Wed, 17 Jul 2002 07:39:06 +0100 (BST)
> >From: Prof Brian D Ripley <ripley at stats.ox.ac.uk>
> >Subject: Re: [R] R GUI and object browser
> >
> >This may be appealing, but
> >
> >1) R objects such as lists have shared components. You get the creation
> >date of the object, not of it components, and in any case I suspect you
> >want the last modification date.
> Do you mean that it is possible for a user to have an object appear in
> two lists, or just that this is done internally?
> For an example of the former, I'm wondering if it's possible to have
> list1$A and list2$A be the same thing, so that changes to list1$A
> affect list2$A as well.
> I think it used to be possible to do this using .Alias, but I thought
> the support for it had been dropped, as it caused too many problems.

It's possible at C level, but not (intentionally) at R level.  At R level,
the supposition is that an object will be copied when it is changed, if
necessary (but from time to time the implementation has been faulty).
However, in a .Call/.Internal/.External call, it is up to the programmer
whether to copy objects or not, and sometimes the choice is not to (e.g.
in the current ts code).   (Also by using .C/.Fortran with dup=FALSE.)

My main point was that the creation date of a list and of its components
may be very different, and one probably does not want the creation date of
the list itself.  It's a similar issue in finding the size of an object.
As I understand it, both are unambiguous in saved S objects, where a file
is written out containing all the object, and the file modification date
is that of the object.  (S objects in memory, including the session
database, are less clearcut.)  On the other hand, a R saved workspace
may well contain shared components.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list