Dieter Menne <dieter.menne at menne-biomed.de> wrote
Technically a good point, but I found it helpful for starters who want to avoid the inferno of "what's attached now?" not to use it at all. My suggestion is to use with() instead because it has a higher locality. I know, many of the examples use attach.
As a beginner, I find this whole issue very hard to grapple with. When to use attach with $ syntax data = or load I have seen many books and manuals say to just avoid using "attach" at all, but several of these then go on to use "attach" quite often. But I run into conceptual problems with all these methods, particularly when I am trying to operate on subsets of a data frame, and then sometimes need to use the [ and ] syntax, sometimes subset = within a function, and sometimes create a separate data frame to then use (but here attach can cause tons of problems). Do other beginners share my confusion? Can some expert point a path through this confusion? thanks Peter PS As a beginner, I appreciate the time that several posters are now taking to elucidate things that may seem obvious. Peter L. Flom, PhD Statistical Consultant www DOT peterflomconsulting DOT com