browserText {base}R Documentation

Functions to Retrieve Values Supplied by Calls to the Browser


A call to browser can provide context by supplying either a text argument or a condition argument. These functions can be used to retrieve either of these arguments.


browserText(n = 1)
browserCondition(n = 1)
browserSetDebug(n = 1)



The number of contexts to skip over, it must be non-negative.


Each call to browser can supply either a text string or a condition. The functions browserText and browserCondition provide ways to retrieve those values. Since there can be multiple browser contexts active at any time we also support retrieving values from the different contexts. The innermost (most recently initiated) browser context is numbered 1: other contexts are numbered sequentially.

browserSetDebug provides a mechanism for initiating the browser in one of the calling functions. See sys.frame for a more complete discussion of the calling stack. To use browserSetDebug you select some calling function, determine how far back it is in the call stack and call browserSetDebug with n set to that value. Then, by typing c at the browser prompt you will cause evaluation to continue, and provided there are no intervening calls to browser or other interrupts, control will halt again once evaluation has returned to the closure specified. This is similar to the up functionality in gdb or the "step out" functionality in other debuggers.


browserText returns the text, while browserCondition returns the condition from the specified browser context.

browserSetDebug returns NULL, invisibly.


It may be of interest to allow for querying further up the set of browser contexts and this functionality may be added at a later date.


R. Gentleman

See Also


[Package base version 3.6.0 Index]