browser() misbehavior ?
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