On 16 Nov 2007, at 14:16, Duncan Murdoch wrote:

> On 11/16/2007 6:58 AM, Yan Wong wrote:
>> Hi,
>> I can't seem to find a way to do this (i.e. interrupt a routine at  
>> an  arbitrary time during its run, then step into it using the  
>> debugger).
>
> If you prepare in advance by using options(error=recover), it's easy:
>
> > options(error=recover)
> > f <- function() {
> +  i <- 0
> +  repeat {
> +     i <- i + 1
> +     x <- rnorm(10000)
> +  }
> + }
> > f()
>
> # At this point, R appears hung up.  I hit Esc in the Windows  
> Rgui.  In Unix or Rterm, you'd use Ctrl-C.

That's exactly what I wanted. Thank you. I didn't realise that  
sending an interrupt signal was treated as a "normal" error.

Out of interest, is there any way to resume the routine from where it  
was interrupted (and ideally do so in debugger mode, so I can step  
through the lines of the code)?

Thanks again

Yan

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to