Dear all, I am using browse() to debug my R applications. My problem is that I need a bit more control of the debugging process. For example 'I want R to stop at the 7th iteration and check. One can do think that I can put the browse inside an if statement but this limits by lot the flexibility one can have. Do you have any suggestions? Regards Alex [[alternative HTML version deleted]]
Hi Alex, some hints and advices on debugging can be found in the 'Writing R Extensions Manual': http://cran.r-project.org/doc/manuals/R-exts.html#Debugging-R-code Depending on the IDE/editor you are using, there may be additional debugging tools/options, but without further informations about your working environment it is hard to give you specific suggestions. Best, Michael
On Sun, Feb 5, 2012 at 3:01 AM, Alaios <alaios at yahoo.com> wrote:> Dear all, > I am using browse() to debug my R applications. My problem is that I need a bit more control of the debugging process. > > For example 'I want R to stop at the 7th iteration and check. One can do think that I can put the browse inside an if statement but this limits by lot the flexibility one can have. >Its not clear what the flexibility limitation you have in mind is. This seems similar with the small advantage that the debugging code is confined to the browser statement itself:> for(i in 1:10) { print(i); browser(expr = i==7) }[1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 Called from: top level Browse[1]> -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
On 12-02-05 3:01 AM, Alaios wrote:> Dear all, > I am using browse() to debug my R applications. My problem is that I need a bit more control of the debugging process. > > For example 'I want R to stop at the 7th iteration and check. One can do think that I can put the browse inside an if statement but this limits by lot the flexibility one can have.The trace() function is very flexible, and has the advantage that it modifies functions in place, rather than requiring you to edit your source. The disadvantage is that it is so flexible it's sometimes hard to figure out how to do what you want. Duncan Murdoch> > Do you have any suggestions? > > Regards > Alex > [[alternative HTML version deleted]] > > > > > ______________________________________________ > R-help at 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.