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". 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 canYes, 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Douglas Bates wrote:> > Marcus Eger <marcus.eger at physik.uni-marburg.de> writes: > > > 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. > > Umm, the S language is a functional language and you probably > shouldn't try to write a 1000 line S function in the first place. The > power of S comes from the abilities to call functions within other > functions and to construct new functions easily. It is not > well-suited to long, monolithic "programs".I just gave the above "program" example to illustrate my question. I understand that it seems to be difficult to have sth. like line numbers in S objects. However, the idea that browser() would cause a jump of the cursor to the corresponding position in the ESS source window would be a nice feature (at least for me). -- +------------------------------------------------------- | 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Robert Gentleman wrote:> > try > where > i think it's in the help pageI don't have any "where" function in my packages.... To which package does it belong? ----------%<---------------- R : Copyright 2000, The R Development Core Team Version 1.1.1 (August 15, 2000) ... KernSmooth 2.22 installed Copyright M. P. Wand 1997 Locfit for R 0.99.0. Feb 14, 2000. -- +------------------------------------------------------- | 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._