On 16 Nov 2007, at 15:05, Gabor Grothendieck wrote:

> Try this:
>
> f <- function() {
>    for(i in 1:1000) {
>      if (i == 50) browser()
>      print(i)
>   }
> }
>
> # enters debugger when i is 50.
> # n/c/Q will step one statement/continue/Quit respectively
> f()

Thanks. The problem is that I don't know when it will hang, so I  
don't know under which conditions I should invoke the browser (e.g.  
in your code I don't know if it is on the 50th iteration, or the  
500th that I wish to exit to the debugger). To find out would require  
running it again using the same random seed and outputting the loop  
number each time, which I'd prefer not to do, given that it takes a  
few days of running the program to get to this point.

Cheers

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