tracker {RUnit} | R Documentation |
The current implementation uses the 'closure trick' to hide all details from
the user and only allows to retrieve the results of the code inspection.
tracker
is used to create a new environment to manage and store the results
of the tracking process. The inspect
function requires such an
environment with the name "track" (currently mandatory). The tracker records how often each
and every function was called by inspect
and summarizes the results of
all calls.
tracker$init
initializes the tracker environment.
tracker$getTrackInfo
returns a list with the tracked results of the
inspection process.
track <- tracker() track$init() track$getTrackInfo()
The return object is a list with the following elements.
Thomas K"onig, Klaus J"unemann & Matthias Burger
inspect
for the registration of functions & methods to
be on the tracking list.
## example functions foo <- function(x){ y <- 0 for(i in 1:100) { y <- y + i } return(y) } bar <- function(x){ y <- 0 for(i in 1:100) { y <- y - i } return(y) } ## the object name track is 'fixed' (current implementation) track <- tracker() ## initialize the tracker track$init() ## inspect the function ## resFoo1 will contain the result of calling foo(50) resFoo1 <- inspect(foo(50), track=track) resFoo2 <- inspect(foo(20), track=track) resBar1 <- inspect(bar(30), track=track) ## get the tracked function call info for all inspect calls resTrack <- track$getTrackInfo() ## create HTML sites in folder ./results for all inspect calls printHTML.trackInfo(resTrack)