[R] Q: how to interrupt long calculation?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 30 19:00:49 CEST 2007


On Thu, 30 Aug 2007, D. R. Evans wrote:

> Paul Smith said the following at 08/29/2007 04:32 PM :
>
>> The instance of R running will be immediately killed and then you can
>> start R again.
>
> But then I would lose all the work. There must be some way to merely
> interrupt the current calculation. Mustn't there?

Only if it is long-running in R code, when ctrl-C or equivalent (Esc in 
Rgui) works. If it is long-running in C or Fortran code, there is not.

Assuming a Unix-alike, sending SIGUSR1 will save the current workspace and 
quit.  Even that is a little dangerous as the workspace need not be in a 
consistent state.

People who have been bitten will learn safer programming practices, for 
example to call save.image() at suitable checkpoint times.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list