[R] "attach" in R corr. to Spus one

Liaw, Andy andy_liaw at merck.com
Wed Jun 9 15:00:51 CEST 2004


Now that I acutally read the original question:

If there are .RData files in other directories that you want to attach(),
you can certainly do that.  One difference between R and S-plus is that in
S-plus you can attach() a directory at position 1, effectively making that
the place that new objects are stored.  In R, attach()ing at position 1 is
not allowed.  I must say that I like the way R works better, as it does a
better job at preventing me from keeping garbage around.

Best,
Andy

> From: Liaw, Andy
> 
> > From: Frank E Harrell Jr
> > 
> > Petr Pikal wrote:
> > > Hallo
> > > 
> > > On 9 Jun 2004 at 2:06, Utsav Boobna wrote:
> > > 
> > > 
> > >>Hi,
> > >>    I am a newbie to R, just trying to switch from
> > >>Splus. I am wondering to know if there is any such
> > >>command in R as "attach" in Splus which can be used to
> > >>attach the full directory.
> > > 
> > > 
> > > I would recommend you to spent some time going through 
> > docummentation and 
> > > especially FAQs. 
> > > 
> > > getwd and setwd for setting the working directory
> > > 
> > > but in R objects are stored in one file .Rdata.
> > 
> > I prefer to control which objects are stored, and to use 
> > compression, by 
> > using save( ) and load( ), rather than using the .Rdata mechanism. 
> > save( ) can store one object or an entire series of objects 
> > in one .rda 
> > file.
> 
> I mostly do the same.  For fairly large objects or objects 
> that I do not
> want to accidentally alter during a session, I use attach() instead of
> load().  One convenience of attach() is that since the objects are not
> loaded into .GlobalEnv, I would have a less cluttered .RData 
> even if I do
> save the workspace when I q().
> 
> Cheers,
> Andy
> 
>  
> > Frank
> > 
> > > 
> > > OTOH in S+ objects are (were - I did not use it since quite 
> > a lot time) stored as 
> > > separate files.
> > > 
> > > For attaching objects see
> > > 
> > > ?attach
> > > 
> > > Cheers
> > > Petr
> > > 
> > > 
> > >>Also, any idea/referrence about, how to load c
> > >>functions in R would be highly appreciated.
> > >>
> > >>Thanks,
> > >>Utsav
> > > 
> > > Petr Pikal
> > > petr.pikal at precheza.cz
> > > 
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> > > 
> > 
> > 
> > -- 
> > Frank E 
> > Harrell Jr   Professor and Chair           School of Medicine
> >                       Department of Biostatistics   
> > Vanderbilt University




More information about the R-help mailing list