[R] attaching something.RData in pos=1

Thomas Lumley thomas at biostat.washington.edu
Thu Oct 5 23:08:52 CEST 2000

On Thu, 5 Oct 2000, Peter Perkins wrote:

> hi -
> running R 1.1.1 under LinuxPPC:
> i was pleasantly surprised to find that attaching .RData files was added
> somewhere along the line, but i am having trouble getting the sort of
> behavior that i got used to in S.  specifically, i'd like to be able to
> attach() a file at pos=1 and edit its contents directly, then save() and
> detach() it.  i know i can load() the file, but this merges its contents
> with the current global environment.  i could attach() at pos=2, but
> that makes editing/creating/deleting awkward.  i could q() and restart R
> from another directory, but that is also awkward.
> i guess i still haven't quite figured out how the global environment is
> supposed to work.  when i attach(file, pos=1), R does something funny: 
> it seems to do a load(file) and then put an empty (at least ls() sees it
> as empty) reference to the file in the search list at pos=2.

You can't attach at pos=1. This is in the FAQ, but needs to be in the
documentation for attach().
At the moment you need to edit things in the global environment. You don't
need to start R in another directory to do this. You can use the
--no-restore flag and start in the same directory.


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