R: Environment Browser

browser {base} | R Documentation

## Environment Browser

### Description

Interrupt the execution of an expression and allow the inspection of the environment where `browser` was called from.

### Usage

    browser()

### Details

A call to `browser` can be included in the body of a function. When reached, this causes a pause in the execution of the current expression and allows access to the R interpreter.

At the browser prompt the user can enter commands or R expressions. The commands are

`c`
  (or just return) exit the browser and continue execution at the next statement.
`cont`
  synonym for `c`.
`n`
  enter the step-through debugger. This changes the meaning of `c`: see the documentation for `debug`.
`where`
  print a stack trace of all active function calls.
`Q`
  exit the browser and the current evaluation and return to the top-level prompt.

(Leading and trailing whitespace is ignored, except for return).

Anything else entered at the browser prompt is interpreted as an R expression to be evaluated in the calling environment: in particular typing an object name will cause the object to be printed, and `ls()` lists the objects in the calling frame. (If you want to look at an object with a name such as `n`, print it explicitly.)

The number of lines printed for the deparsed call can be limited by setting `options(deparse.max.lines)`.

### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Chambers, J. M. (1998) Programming with Data. A Guide to the S Language. Springer.

### See Also

`debug`, and `traceback` for the stack on error.

[Package base version 2.8.1 Index]