Learn R Programming

RUnit (version 0.4.33)

printHTML: Write HTML pages of the tracking result.

Description

printHTML creates a subdirectory named "result" in the base directory specified via baseDir. All HTML pages and images will be put in that directory.

Usage

printHTML(object, baseDir = ".")

Arguments

object

'trackInfo' S3 class object (list), containing the result of the function tracker.

baseDir

A character string, specifying the base directory for the HTML pages to be written to. Defaults to the current working directory.

Author

Thomas König, Klaus Jünemann & Matthias Burger

Details

An "index.html" page will be created in the directory "results" which is the root entry page of the HTML pages. The displayed result for every tracked function consists of two HTML pages. The first page is an overview on how often every line of code was executed. Code lines not executed are highlighted red, executed lines are shown in green. The second page is a graph representation of the execution flow of the function. Each code line has a edge pointing to the next code line that is executed subsequently. Thus loops and jumps become clearly visible.

See Also

tracker for the call tracking object definition.

Examples

Run this code

##  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 is the result of foo
res <- inspect(foo(10), track = track)

##  get the tracking info
resTrack <- track$getTrackInfo()

##  create HTML pages
printHTML(resTrack, baseDir=tempdir())

Run the code above in your browser using DataLab