[R] using browser() in complex programs - where am I?

Marcus Eger marcus.eger at physik.uni-marburg.de
Fri Sep 1 12:09:12 CEST 2000


Patrick Connolly wrote:
> 
> According to Marcus Eger:
> |>
> |> Dear all,
> |>
> |> is there an easy way to know at which position in the source code
> |> browser() (or stop()) was called? This seems to be important for me when
> |> I try
> |> to debug a program (e.g. using options(error=quote(dump.frames())))
> |>
> |> traceback() returns some information, but I miss something like a line
> |> number, e.g. "stopped at line 999 in foo.R".
> 
> Depends on what platform and a few things, but it's easy if you're
> using ESS in Emacs.  You can keep the code window open and inspect
> what is available at the point where the browser stops.  You can

Yes, I also use ESS. One can inspect what is available. 
But what do you do if your program
has 1000 lines and say 50 browser() calls - how do you know *which*
browser()-call was hit. Certainly, one can put specific warnings or
messages
before each browser()-call... but isn't there a nicer way e.g. to get
the 
line number?

> probably do that without emacs, but I wouldn't leave the keyboard
> without using emacs.  It's so efficient and easy to work that way.
> 
> You can even use multiple browsers and if there is no distinguishing
> object at that stage you can place dummy ones so you can distinguish
> browser positions.
> 
Yes, one can place dummy objects or print() before a browser()-call.
I thought there could be a nicer way...
   Marcus
  
-- 
+-------------------------------------------------------
| Marcus Eger
| Philipps Universitaet Marburg
| Fachbereich Physik AG Neurophysik
| Renthof 7
| 35032 Marburg
| Tel. +49 6421 282-4169
| Fax  +49 6421 282-7034
+-------------------------------------------------------
| E-Mail: marcus.eger at physik.uni-marburg.de
+-------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list