Dear R-help, This is just a wishlist item: Is it possible at all to make R (optionally) automagically do save.image() periodically (e.g., every fixed number of commands or >= fixed amount of time)? The reason I asked is that I frequently run R-1.3.1 inside XEmacs 21.4.5/ESS 5.1.19 under WinNT, and had seen Rterm.exe crashed a few times for no apparent reason (and not reproducible). When that happens, I lost all the objects created in that R session and had to re-run the script (which could be time consuming). At one time R crashed right in the middle of quitting, which corrupted the .Rdata file. Luckily I had a backup that was fairly recent that I didn't loose everything. (Admittedly, auto-save wouldn't help this last problem though.) Cheers, Andy -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 12 Nov 2001, Liaw, Andy wrote:> Dear R-help, > > This is just a wishlist item: Is it possible at all to make R (optionally) > automagically do save.image() periodically (e.g., every fixed number of > commands or >= fixed amount of time)?It's not possible currently, but it has been mentioned as a possibility. Ideally one would do it by time, but that needs a concurrent operation. It would be safest to save only at the top-level prompt (and make more sense given that the objects are most likely to be complete), but then there would be no saves during loops.> The reason I asked is that I frequently run R-1.3.1 inside XEmacs 21.4.5/ESS > 5.1.19 under WinNT, and had seen Rterm.exe crashed a few times for no > apparent reason (and not reproducible). When that happens, I lost all the > objects created in that R session and had to re-run the script (which could > be time consuming). At one time R crashed right in the middle of quitting, > which corrupted the .Rdata file. Luckily I had a backup that was fairly > recent that I didn't loose everything. (Admittedly, auto-save wouldn't help > this last problem though.)That's also on the agenda. Most word-processors do something like save the file to another name, then rename the files in a non-interruptible operation. The problem there is that one needs double the diskspace, temporarily, so we would need a means to switch this one or off. Several things are going on re saves. There is a new, more compact, format for 1.4.0, we are planning to allow compression, saving over connections, .... For now, I would arrange to call save.image() (or save on the critical files) at strategic points in the calculation). As someone said recently on S-news, it is sometimes (often?) Windows that crashes, not R (or S-PLUS). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
The question of performing auto-saves every n commands goes back several weeks, but hopefully the delay in responding is worthwhile. The upcoming version 1.4.0 of R has a facility (addTaskCallback()q) by which one can register a collection of functions that are invoked at the end of each (successful) top-level expression. This can be used perform auto-saves, and other things such as updating GUI displays, commiting changes to databases (i.e. transactions), validation of objects, etc. One can even examine the expression that was just evaluated and check if it was an assignment, or if it changed an important variable that should be saved. There is a description of the mechanism at http://developer.r-project.org/TaskHandlers.pdf Unlike other suggestions, I think doing auto-saves on the basis of time is not the ideal approach. As others have pointed out, it relies on the nature of the event loop which is neither portable or likely to remain exactly the same. After 1.4.0 is released, I plan to add timers and readers/callbacks for connections and that will give different features and also characteristics. I hope the addTaskCallback() does what you want. D. Liaw, Andy wrote:> Dear R-help, > > This is just a wishlist item: Is it possible at all to make R (optionally) > automagically do save.image() periodically (e.g., every fixed number of > commands or >= fixed amount of time)? > > The reason I asked is that I frequently run R-1.3.1 inside XEmacs 21.4.5/ESS > 5.1.19 under WinNT, and had seen Rterm.exe crashed a few times for no > apparent reason (and not reproducible). When that happens, I lost all the > objects created in that R session and had to re-run the script (which could > be time consuming). At one time R crashed right in the middle of quitting, > which corrupted the .Rdata file. Luckily I had a backup that was fairly > recent that I didn't loose everything. (Admittedly, auto-save wouldn't help > this last problem though.) > > Cheers, > Andy > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- _______________________________________________________________ Duncan Temple Lang duncan at research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._