[R] What objects will save.image saves ? And how to specify objects to be saved..
tplate at acm.org
Wed Apr 16 19:55:58 CEST 2008
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):
> 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 <wwwhsd at gmail.com>
>> See ?save
>> On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley <stanleyngkl at gmail.com>
>>> 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
>>> saved to R.data ? If yes, how can I specify save.image to save only
>>> objects created in the R script ?
>>> [[alternative HTML version deleted]]
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide
>>> and provide commented, minimal, self-contained, reproducible code.
>> Henrique Dallazuanna
>> 25° 25' 40" S 49° 16' 22" O
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> 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