inspect {RUnit} | R Documentation |
inspect
examines and modifies the source code of a function or
method. After the modification 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.
inspect(expr, track = track)
expr |
Any R function or method call. |
track |
list object, as returned by a call to |
The return value of inspect
is the result returned by
the function executed. If the function has no return value nothing is
returned either.
Thomas König, Klaus Jünemann & Matthias Burger
tracker
for the call tracking object, and
printHTML.trackInfo
for displaying results.
## 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)