[R] is auto-save possible?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Nov 13 09:49:52 CET 2001


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> 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.

In principle, tkcmd("after",...) from the tcltk package can schedule
timed events, but I'm a little unsure what happens if you put
save.image() inside of it... It might be worth a try, but don't do it
on valuable data! This should save once per minute (although not
during computations):

library(tcltk)
f <- function() {save.image() ; tkcmd("after", 60e3, f)}
f()

(One way of stopping it is to remove f)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list