[R] interrupt in Linux

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Mon Jun 14 22:21:40 CEST 2004


On 14-Jun-04 Bickel, David wrote:
> Does anyone know how to interrupt R in RedHat? Neither control-c nor
> Esc is working. What I don't want to do is close the window or kill the
> entire R process.
> 
> Thanks,
> David

Ctrl-C should interrupt what R is doing and return you to the R command
prompt. ESC (at the R command prompt) will probably be seen by 'readline'
as the lead-in to an escape sequence, with possibly unpredictable
results.

For example,

> for(i in (1:10^5)){rnorm(10)}

takes about 20 seconds on my old laptop. However, if I start it again,
and press Ctrl-C after a couple os seconds, then it stops almost
immediately.

Red Hat 9.1, R version 1.8.0

But I think R may need to unwind things that it has set up before
returning to the prompt when you press Ctrl-C, so if what you were
doing has made a lot of heavy stuff, then it might take a while
before you get the prompt back.

If Ctrl-C really won't work at all, then you may have an stty
problem.

In a normal xterm window (shell prompt) enter

  stty -a

which should return a lot of stuff beginning like:

> stty -a
speed 38400 baud; rows 56; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; ... ...

and you need to see the "intr = ^C". If not, then you don't have
Ctrl-C set as interrupt. In which case, consult "man stty"!

Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 14-Jun-04                                       Time: 21:21:40
------------------------------ XFMail ------------------------------




More information about the R-help mailing list