From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Sat 24 Mar 2001 - 08:17:54 EST
Message-ID: <x27l1gxh7x.fsf@blueberry.kubism.ku.dk>
Alojz Loui Polic <lpolic@ineural.com> writes:
> Hi
>
> I'm just starting with R-plus and I have noticed
?????
> the following behaviour.
>
> If a data.frame is attached and then removed before
> being detached, the data is still present in the
> path and can accessed. Is this expected behaviour,
> and if so why?
It's designed that way. Whether or not that is a good thing is
debatable - people easily get bitten from attaching a data frame and
modifying it without that affecting the attached version. One upside
is that the argument to attach() can be an arbitrary expression, e.g.
AA <- c(1, 1, 1, 1, 1)
BB <- c(2, 3, 2, 1, 2)
attach(data.frame( AA.data=AA, BB.data=BB)
[It is not a trivial exercise to think up an alternative semantic
model for attached objects. One problem being that modifying an object
in R is more often than not a compute-and-rename operation, so
accessing an object by reference is not possible (although reference
by name is).]
-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2b30 : Fri 22 Jun 2001 - 18:58:37 EST