[R] How do you save in R?

Patrick Burns pburns at pburns.seanet.com
Mon May 18 09:46:22 CEST 2009


I disagree with Dieter's last point.
Whether you use 'attach' or 'load'
should depend on whether you want the
objects in the file to remain separate
('attach') or mixed into the global
environment ('load').


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

Dieter Menne wrote:
> prixel <snickersoof <at> yahoo.com> writes:
> 
>> I know it sounds like a silly question but whenever i click on "save to file"
>> it doesn't save. 
> 
> Assuming "it" is Windows GUI and not your grandmother's knitting needles,
> "save to file" writes the selected part of the GUI to a file and is not
> that useful as a function. 
> You should use File/Save Workspace instead, but better avoid this approach
> and use save(mydata1, mydata2, file="mydata.Rdata") instead to have
> reproducible results.
> 
>> whenever i use the function attach(___) it doesn't work,
> 
> Best avoid using attach at all. It can be more confusing than helpful.
> 
>> and says object can not be found. i have a series of data (0,0,0,1,1) that i
>> need to save, then i want to attach(...) it in another R window.
> 
> Use load("the file you saved above.Rdata") instead in the new R Window.
> 
> Dieter
> 
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list