[R] set breakpoint in debug

Simon Zehnder szehnder at uni-bonn.de
Mon Sep 16 21:14:13 CEST 2013


You could just use debug(f) and then when the Browser opens and the loop begins type 'c', that jumps over the loop to next line after the loop. 

Best

Simon

On Sep 16, 2013, at 9:05 PM, Hui Du <Hui.Du at dataventures.com> wrote:

> Hi All,
> 
> I need some help regarding how to set up a breakpoint in debug. For example, I have a very simple/naïve function (a useless function just for demo)
> 
> f = function()
> {
>    x = 10;
>    len = 100;
> 
>    a = 1;
>    for(i in 1:len)
>    {
>        a = a * i;
>    }
> 
> y = x + a;
> y;
> }
> 
> 
> If I need to debug it, I can run debug(f). After I go into the debugger, if I want to skip the loop and stop in the statement y = y + a, directly, how to do that? I know R has a function named setBreakpoint but I have never used it correctly.
> 
> Your help is highly appreciated.
> 
> HXD
> 
> 	[[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.



More information about the R-help mailing list