Dieter Menne wrote:


Christophe Dutang1 wrote:

I would like to know what happens on the memory side when I use
attach(inputdata)

Is there a second allocation of memory for inputdata?


Not, it just guides the syntax.

Wrong. There's a virtual copy of data plus a conversion from data frame to attached environment on the search path. If you modify data in either of the original frame or the environment, you will get duplication.


Christophe Dutang1 wrote:
Is it better not to use attach function?


A qualified "yes" in the sense of  "do not use it". I think it is used to
much in old documentation, presumably because some S eggshells.

I use with() if I have a nasty formula to unclutter; it acts locally only
and you don't get unwanted side effects.

Well, opinions vary. Having to qualify data frame access on each use does tend to get in the way of explorative work, at least it does so for me.

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalga...@biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to