[R] odd behavior of browser()
Duncan Murdoch
murdoch.duncan at gmail.com
Tue Dec 4 19:22:47 CET 2012
On 04/12/2012 12:54 PM, David Romano 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?
I wouldn't have expected that to work. Calling browser() from within a
function will let you step through the function, but calling it from
within a script doesn't. Do you really have some scripts where this worked?
Duncan Murdoch
>
> 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