inspect                package:RUnit                R Documentation

_T_r_a_c_k _t_h_e _e_x_e_c_u_t_e_d _c_o_d_e _l_i_n_e_s _o_f _a _f_u_n_c_t_i_o_n _o_r _m_e_t_h_o_d.

_D_e_s_c_r_i_p_t_i_o_n:

     'inspect' examines and modifies the source code of a function or
     method.  After the modifcation of the source code, the modified
     function will be executed and the result of the tracking process
     will be stored. To store the information a 'tracker' environment
     with the name track must exist. Note, that not all R code
     constructs can be handled at the current state. In some cases it
     is not possible to track a specific code line. Therefore, clearly
     structured code with consequent use of opening and closing braces
     to indicate conditional expressions can prevent these parser
     problems.

_U_s_a_g_e:

       inspect(expr, track=track)

_A_r_g_u_m_e_n_t_s:

    expr: Any R function or methods call.

   track: list object, as returned by a call to 'tracker'.

_D_e_t_a_i_l_s:

     The return value of 'inspect' is the result returned by the
     function executed. If the function has no return value nothing is
     returned either.

_A_u_t_h_o_r(_s):

     Thomas K\"onig, Klaus J\"unemann & Matthias Burger

_S_e_e _A_l_s_o:

     'tracker' for the call tracking object.

_E_x_a_m_p_l_e_s:

     ## example function
     foo <- function(x){
        y <- 0
        for(i in 1:100)
        {
           y <- y + i
        }
        return(y)
     }

     ## the name track is necessary
     track <- tracker()

     ## initialize the tracker
     track$init()

     ## inspect the function
     ## res will collect the result of calling foo
     res <- inspect(foo(10), track=track)

     ## get the tracked function call info
     resTrack <- track$getTrackInfo()

     ## create HTML sites
     printHTML.trackInfo(resTrack)

