[R] To improve my understanding of workspaces

Duncan Murdoch murdoch at stats.uwo.ca
Fri Mar 10 14:33:09 CET 2006

Other than Emacs, I use the same work habits as Adai.  An advantage of 
this workflow is that almost everything is stored in text format, so it 
is easy to compare different versions to see what has changed, and it 
works very well with version control (I use Subversion).

The only thing I'd add to his recommendation is that you be sure to save 
the scripts that produced the objects in the binary images (his 
"lala.rda"), so that they can be reconstructed if necessary.  As long as 
the reconstruction isn't too difficult, this means I don't need to 
bother to save them in Subversion.

Duncan Murdoch

On 3/10/2006 8:25 AM, Adaikalavan Ramasamy wrote:
> I use emacs and ESS to develop the scripts. The new releases of R has
> the script function already in built.
> Typically I keep all the data and scripts related to a project in its
> own folder, so I have minimal worry about paths.
> To save large and associated objects, I use 
>    save(x, y, z, file="lala.rda", compress=TRUE) 
> and then to load x, y, z in another session or workspace I use
>    load("lala.rda") 
> To save small dataframes and matrices, I use 
>    write.table(mat, file="lala.txt", sep="\t") 
> and to read it back I use
>    mat <- read.delim(file="lala.txt", row.names=1)
> The problem with .RData (via quit or save.image), is that it keeps all
> intermediate objects which can be unnecessarily bloated and confusing.
> Further you will have difficulty distinguishing one .RData from the
> other by looking at the filename alone.
> Regards, Adai
> On Fri, 2006-03-10 at 06:58 -0500, Kevin E. Thorpe wrote:
>> Hello.
>> I have grown accustomed to the .Data directory in S-Plus and so when
>> I came to R I continued that behaviour by saving my workspaces at
>> the end of each R session.  So, I have saved workspaces in various
>> directories where I have used R just as I would have had various
>> .Data directories where I had used S-Plus.
>> I have seen comments on the list, most recently from Prof. Ripley
>> that they don't routinely save their workspaces in this way.
>> So my questions are:
>>    1. What do people do instead to manage projects?
>>    2. Is there an "official" recommendation?
>>  From my reading I have learned that you can save data frames
>> (and other objects?) to disk and then attach them.  Does this
>> save memory?  If I have read correctly, I understand that
>> everything in the workspace is in memory, but haven't been able
>> to determine if objects in the search path are as well.
>> Kind Regards,
>> Kevin
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list