recover                package:utils                R Documentation

_B_r_o_w_s_i_n_g _a_f_t_e_r _a_n _E_r_r_o_r

_D_e_s_c_r_i_p_t_i_o_n:

     This function allows the user to browse directly on any of the
     currently active function calls, and is suitable as an error
     option. The expression 'options(error=recover)' will make this the
     error option.

_U_s_a_g_e:

     recover()

_D_e_t_a_i_l_s:

     When called, 'recover' prints the list of current calls, and
     prompts the user to select one of them.  The standard R 'browser'
     is then invoked from the corresponding environment; the user can
     type ordinary S language expressions to be evaluated in that
     environment.

     When finished browsing in this call, type 'c' to return to
     'recover' from the browser.  Type another frame number to browse
     some more, or type '0' to exit 'recover'.

     The use of 'recover' largely supersedes 'dump.frames' as an error
     option, unless you really want to wait to look at the error.  If
     'recover' is called in non-interactive mode, it behaves like
     'dump.frames'.  For computations involving large amounts of data,
     'recover' has the advantage that it does not need to copy out all
     the environments in order to browse in them.  If you do decide to
     quit interactive debugging, call 'dump.frames' directly while
     browsing in any frame (see the examples).

_V_a_l_u_e:

     Nothing useful is returned.  However, you _can_ invoke 'recover'
     directly from a function, rather than through the error option
     shown in the examples.  In this case, execution continues after
     you type '0' to exit 'recover'.

_C_o_m_p_a_t_i_b_i_l_i_t_y _N_o_t_e:

     The R 'recover' function can be used in the same way as the S-Plus
     function of the same name; therefore, the error option shown is a
     compatible way to specify the error action.  However, the actual
     functions are essentially unrelated and interact quite differently
     with the user.  The navigating commands 'up' and 'down' do not
     exist in the R version; instead, exit the browser and select
     another frame.

_R_e_f_e_r_e_n_c_e_s:

     John M. Chambers (1998). _Programming with Data_; Springer. 
      See the compatibility note above, however.

_S_e_e _A_l_s_o:

     'browser' for details about the interactive computations;
     'options' for setting the error option; 'dump.frames' to save the
     current environments for later debugging.

_E_x_a_m_p_l_e_s:

     ## Not run: 

     options(error = recover) # setting the error option

     ### Example of interaction

     > myFit <- lm(y ~ x, data = xy, weights = w)
     Error in lm.wfit(x, y, w, offset = offset, ...) :
             missing or negative weights not allowed

     Enter a frame number, or 0 to exit
     1:lm(y ~ x, data = xy, weights = w)
     2:lm.wfit(x, y, w, offset = offset, ...)
     Selection: 2
     Called from: eval(expr, envir, enclos)
     Browse[1]> objects() # all the objects in this frame
     [1] "method" "n"      "ny"     "offset" "tol"    "w"
     [7] "x"      "y"
     Browse[1]> w
     [1] -0.5013844  1.3112515  0.2939348 -0.8983705 -0.1538642
     [6] -0.9772989  0.7888790 -0.1919154 -0.3026882
     Browse[1]> dump.frames() # save for offline debugging
     Browse[1]> c # exit the browser

     Enter a frame number, or 0 to exit
     1:lm(y ~ x, data = xy, weights = w)
     2:lm.wfit(x, y, w, offset = offset, ...)
     Selection: 0 # exit recover
     >

     ## End(Not run)

