debug                  package:base                  R Documentation

_D_e_b_u_g _a _f_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Set or unset the debugging flag on a function.

_U_s_a_g_e:

     debug(fun)
     undebug(fun)

_A_r_g_u_m_e_n_t_s:

     fun: any interpreted R function.

_D_e_t_a_i_l_s:

     When a function flagged for debugging is entered, normal execution
     is suspended and the body of function is executed one statement at
     a time. A new browser context is initiated for each step (and the
     previous one destroyed). You take the next step by typing carriage
     return, 'n' or 'next'. You can see the values of variables by
     typing their names. Typing 'c' or 'cont' causes the debugger to
     continue to the end of the function (or loop if within a loop).
     You can 'debug' new functions before you step in to them from
     inside the debugger. Typing 'Q' quits the current execution and
     returns you to the top-level prompt. Typing 'where' causes the
     debugger to print out the current stack trace (all functions that
     are active). If you have variables with names that are identical
     to the controls (eg. 'c' or 'n' ) then you need to use 'print(c)'
     and 'print(n)' to evaluate them.

     In order to debug S4 methods (see 'Methods'), you need to use
     'trace', typically calling 'browser', e.g., as 
      'trace("plot", browser, exit=browser, signature = c("track",
     "missing"))'

_S_e_e _A_l_s_o:

     'browser', 'trace'; 'traceback' to see the stack after an 'Error:
     ...' message; 'recover' for another debugging approach.

