Re: [R] What objects will save.image saves ? And how to specify objects to be saved..

From: Tony Plate <tplate_at_acm.org>
Date: Wed, 16 Apr 2008 11:55:58 -0600

save.image() is a wrapper for save() (Type 'save.image' (without quotes) at the prompt to see the code for the function.)

Try something like this (not tested):

> load("oldvars.RData")
> old.vars <- ls(all=TRUE)
> ... computation ...
> save(list=setdiff(ls(all=TRUE), old.vars), file="newvars.RData")

You can play with the args (pattern= & all=) of ls() to select which vars you are interested in. If your computations might change some of the existing variables, and you want to save those at the end too, you'll probably have to keep track of those manually.

AFAIK, it's not possible to add some new vars to an existing .RData file -- that's why I wrote the above to save them in a .RData file that's different to the one that contained the old variables.

Ng Stanley wrote:
> Read and reread, can't make out. Will try an experiment later....
>
> On Wed, Apr 16, 2008 at 7:51 PM, Henrique Dallazuanna <wwwhsd_at_gmail.com>
> wrote:
>

>> See ?save
>>
>>   On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley <stanleyngkl_at_gmail.com>
>> wrote:
>>
>>>  Hi,
>>>
>>> I have a R script that loads an image R.data, does some operations, then
>>> save to the R.data again. Suppose I have done some computation before
>>> loading the R script, will all the objects before the R script execution
>>> be
>>> saved to R.data ? If yes, how can I specify save.image to save only
>>> those
>>> objects created in the R script ?
>>>
>>> Thanks
>>> Stanley
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>> --
>> Henrique Dallazuanna
>> Curitiba-Paraná-Brasil
>> 25° 25' 40" S 49° 16' 22" O

>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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.


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. Received on Wed 16 Apr 2008 - 18:00:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 20:30:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive