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.

-- Tony Plate

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 <[EMAIL PROTECTED]>
> wrote:
> 
>> See ?save
>>
>>   On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley <[EMAIL PROTECTED]>
>> 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@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@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@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.

Reply via email to