Under v1.6.2, Windows NT4 OS, when a function contains an execution error and I have placed browser() in inside the function body, the call to browser is ignored. A brief example to illustrate:> foo <- function(x) {+ y <- x ^ 2 + browser() + foo2(x) ## Intentional error + x ^ 3 + }>> foo(30)Called from: foo(30) Browse[1]> Error in foo(30) : couldn't find function "foo2" ## browser() still seems to be ignored even if a function has no execution error> traceback()1: foo(30) Has anyone else experienced this? I am using v1.6.2 on Windows NT 4. Under Linux i686 (Mandrake 9.0), the same example works as expected; execution is stopped and I can usefully browser() as it is designed. As always, any advice is welcome. Thanks, Bill ---------------------------------------- Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY84-16 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA v_bill_pikounis at merck.com Phone: 732 594 3913 Fax: 732 594 1565 ------------------------------------------------------------------------------
If I understand you correctly, the call is not ignored (you get a browser prompt up), but the browser gets quit immediately, as if return had been pressed. Note that no error has occurred at the point when browser() is called, so whether the next statement will give an error ought to be immaterial. I don't have access to NT4, but on XP it works as expected (and I do this sort of thing all the time). Puzzling .... On Wed, 29 Jan 2003, Pikounis, Bill wrote:> Under v1.6.2, Windows NT4 OS, when a function contains an execution error > and I have placed browser() in inside the function body, the call to browser > is ignored. A brief example to illustrate: > > > foo <- function(x) { > + y <- x ^ 2 > + browser() > + foo2(x) ## Intentional error > + x ^ 3 > + } > > > > > foo(30) > Called from: foo(30) > Browse[1]> > Error in foo(30) : couldn't find function "foo2" > > ## browser() still seems to be ignored even if a function has no execution > error > > > traceback() > 1: foo(30) > > Has anyone else experienced this? I am using v1.6.2 on Windows NT 4. > > Under Linux i686 (Mandrake 9.0), the same example works as expected; > execution is stopped and I can usefully browser() as it is designed.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Dear Bill, Your example works fine for me with R 1.6.2 under Windows 2000. The behaviour that you report should occur if you press RETURN at the browser prompt, but that seems unlikely. John At 02:07 PM 1/29/2003 -0500, Pikounis, Bill wrote:>Under v1.6.2, Windows NT4 OS, when a function contains an execution error >and I have placed browser() in inside the function body, the call to browser >is ignored. A brief example to illustrate: > > > foo <- function(x) { >+ y <- x ^ 2 >+ browser() >+ foo2(x) ## Intentional error >+ x ^ 3 >+ } > > > > > foo(30) >Called from: foo(30) >Browse[1]> >Error in foo(30) : couldn't find function "foo2" > >## browser() still seems to be ignored even if a function has no execution >error > > > traceback() >1: foo(30) > >Has anyone else experienced this? I am using v1.6.2 on Windows NT 4. > >Under Linux i686 (Mandrake 9.0), the same example works as expected; >execution is stopped and I can usefully browser() as it is designed. > >As always, any advice is welcome. > >Thanks, >Bill > >---------------------------------------- >Bill Pikounis, Ph.D. >Biometrics Research Department >Merck Research Laboratories >PO Box 2000, MailDrop RY84-16 >126 E. Lincoln Avenue >Rahway, New Jersey 07065-0900 >USA > >v_bill_pikounis at merck.com > >Phone: 732 594 3913 >Fax: 732 594 1565 > > > >------------------------------------------------------------------------------ > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >http://www.stat.math.ethz.ch/mailman/listinfo/r-help____________________________ John Fox Department of Sociology McMaster University email: jfox at mcmaster.ca web: http://www.socsci.mcmaster.ca/jfox