[R] odd behavior of browser()

R. Michael Weylandt michael.weylandt at gmail.com
Tue Dec 4 19:08:13 CET 2012


Untested, I think it's the blank line in your script which exits the
debugger and then you're seeing regular execution.

MW

On Tue, Dec 4, 2012 at 5:54 PM, David Romano <dromano at stanford.edu> wrote:
> Hi everyone,
>
> I normally include a call to browser() as I'm working out the kinks in my
> scripts, and I am always able to step through each line by hitting
> "Return", but for some reason, in the scripts I'm working on now, hitting
> "Return" seems to cause execution of *all* the lines in my script.  I've
> restarted R several times in case it was stuck in a bad state for some
> reason, but I'm consistently getting this behavior anyway.  Has anyone run
> into this problem before?  Maybe I inadvertently reset preferences?
>
> An example which produces this behavior is the following:
>
> file bugcheck.r:
>
> browser()
>
> a <- 1
> b <- 2
>
>> source("bugcheck.r")
> Called from: eval(expr, envir, enclos)
> Browse[1]>  <Return>
>>
>> ls()
> [1] "a" "b"
>> a
> [1] 1
>> b
> [1] 2
>
> I'd be grateful for any help in resolving this!
>
> Thanks,
> David Romano
>
>         [[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