Re: [R] browser/debug and for loop

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Sat 29 Jun 2002 - 19:21:55 EST


Message-id: <x2vg82l9sc.fsf@biostat.ku.dk>

Vadim Ogranovich <vograno@arbitrade.com> writes:

> Dear R-Users,
>
> It seems like once one invokes browser() inside a loop and steps through the
> body using 'n' any subsequent loop will be "intercepted" by debug()
> function. Here is exactly what I mean
>
> # fresh R session
> # run a loop that has browser() inside the body
> > for (i in seq(5)) { browser(); print(i) }
> for (i in seq(5)) { browser(); print(i) }
> Called from: NULL
> Browse[1]> n
> n
> debug: print(i)
> Browse[1]> Q
> Q
>
> # remove browser(), debug() is still there
> > for (i in seq(5)) { print(i) }
> for (i in seq(5)) { print(i) }
> debug: i
> Browse[1]> Q
> Q
>
> My guess is that when I was stepping through some function got flagged for
> debugging. I tried to undebug "for", but that didn't work.
>
> This is R.1.5.0 on RedHat Linux 7.1
>
> Any suggestion will be appreciated.

The effect is still there in 1.6.0pre. However, it doesn't seem to be
"for" that got the debug flag set, but "{":

> {i}
debug: i
Browse[1]>
[1] 4

I can't think of an immediate workaround except: "just don't do
that"...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:34 EST