[R] detach()

Liaw, Andy andy_liaw at merck.com
Mon Mar 22 21:44:55 CET 2004


> From: Rolf Turner
> 
> Dear Brian,
> 
> You wrote:
> 
> > If that is to be allowed, then it has to take precedence. What would
> > you expect if I did
> > 
> > data(women)
> > attach(women)
> > women <- 4
> > detach(women)
> 
> I would basically expect either all hell to break loose, mainly
> because of the overwriting of ``women'' or the data base in position
> 4 to be detached.

Don't think so.  attach(women) places a copy of `women' in search position
2.  women <- 4 creates another object holding the value 4 in the global
environment.  No data have been destroyed or overwritten.  

[The current behavior of detach() apparently detaches `women' from position
2, rather than detaching whatever is in position 4.  This _is_ what I would
expect, although I'd say whoever writes real code like that deserves all the
confusion he/she gets...]

Cheers,
Andy


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list