On 16/02/2011 9:04 AM, Jan van der Laan wrote:
One possible solution is to use something like:

a<- 0
for (i in 1:1E6) {
      old.a<- a

      # do something e.g.
      a<- runif(1)<  1E-6

      if (a != old.a) browser()
}


Another solution is to write your output to file (using sink for
example) and to watch this file using a tool like tail.


The trace() function provides this kind of thing temporarily, with a lot of flexibility. setBreakpoint() provides a slightly more friendly way to construct arguments to it -- you can say to set the breakpoint at line 7, not having to work out that line 7 is the 3rd statement within the 2nd statement block in the function.

Duncan Murdoch

______________________________________________
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