Interaction after Error

DESCRIPTION:

Browses the evaluation frame in which an error was returned, to aid in debugging S-PLUS code.

USAGE:

recover() 

Error Recovery:

The standard approach to error recovery in S-PLUS is to browse in the evaluation frame where the problem was found. The recover function is an interactive browser for this purpose. You can type any S-PLUS expression when recover is invoked, and S-PLUS evaluates it in the current frame. Usually, printing the values of a few variables is enough to understand the cause of the problem. You can then type q to leave recover and interact with S-PLUS again.

Alternatively, you can edit data in the current evaluation frame and attempt to continue with the computation. Assignments can be made in the frame to modify existing variables or to create new variables. When you are finished editing, type go at the recover prompt and S-PLUS resumes the computation. If another problem occurs, you remain in recover and the changes you made previously to the data are still in effect.

The following names act as special commands in recover. Any other input is interpreted as an ordinary S-PLUS expression.

 
   up     Move to the next parent frame.
   down   Move back to the previous child frame.
   go     Try the expression again.
   dump   Dump all of the frames and resume S-PLUS
           at the top level.
   q      Resume S-PLUS at the top level without dumping.

The first two of these navigational commands allow you to browse and edit in other frames. To see which frames are active, type traceback(). You can also browse explicitly in another frame by typing browser(n), where n is a frame number. This moves you from recover to browser; the interfaces for these two functions are very similar. To return to recover, exit browser by typing q.

The navigational command go is used after you've revised some data in the frame and you wish to restart the computation to see if the problem has been resolved. The function call in which you are currently browsing restarts with any revised data included. The navigational commands dump and q resume S-PLUS execution at the top level. The only difference between the final two commands is that dump produces a dump of all the frames currently active, for later use with the debugger function.

SEE ALSO:

, , .

EXAMPLES:

> sqrt(exp) 
Problem in x^0.5: Non-numeric first operand 
Recovering in the frame of "sqrt"  
R> ? 
Type any expression.  Exit with one of the commands: 
dump  # dump frames, end this task 
q     # end this task, no dump 
go    # retry the expression, with corrections made 
Local Variables: x  
R> class(x) 
[1] "function" 
R> x <- exp(1) 
R> go 
[1] 1.648721