Learn R Programming

rapport (version 0.51)

rapport: Evaluate Template

Description

This is the central function in the rapport package, and hence eponymous. In following lines we'll use rapport to denote the function, not the package. rapport requires a template file, while dataset (data argument) can be optional, depending on the value of Data required field in template header. Template inputs are matched with ... argument, and should be provided in x = value format, where x matches input name and value, wait for it... input value! See tpl.inputs for more details on template inputs.

Usage

rapport(fp, data = NULL, ..., env = new.env(),
    reproducible = FALSE, header.levels.offset = 0,
    graph.output = evalsOptions("graph.output"),
    file.name = getOption("rp.file.name"),
    file.path = getOption("rp.file.path"),
    graph.width = evalsOptions("width"),
    graph.height = evalsOptions("height"),
    graph.res = evalsOptions("res"),
    graph.hi.res = evalsOptions("hi.res"),
    graph.replay = evalsOptions("graph.recordplot"))

Arguments

fp
a template file pointer (see tpl.find for details)
data
a data.frame to be used in template
...
matches template inputs in format 'key = "value"'
env
an environment where template commands be evaluated (defaults to new.env()
reproducible
a logical value indicating if the call and data should be stored in template object, thus making it reproducible (see tpl.rerun for details)
header.levels.offset
number added to header levels (handy when using nested templates)
file.name
set the file name of saved plots and exported documents. A simple character string might be provided where %N would be replaced by an auto-increment integer based on similar exported document's file name , %n an auto-incr
file.path
path of a directory where to store generated images and exported reports
graph.output
the required file format of saved plots (optional)
graph.width
the required width of saved plots (optional)
graph.height
the required height of saved plots (optional)
graph.res
the required nominal resolution in ppi of saved plots (optional)
graph.hi.res
logical value indicating if high resolution (1280x~1280) images would be also generated
graph.replay
logical value indicating if plots need to be recorded for later replay (eg. while printing rapport objects in R console)

Value

  • a list with rapport class.

Details

Default parameters are read from evalsOptions() and the following options:

  • 'rp.file.name',
  • 'rp.file.path',

See Also

rapport-package

Examples

Run this code
rapport("example", ius2008, var = "leisure")
rapport("example", ius2008, var = "leisure", desc = FALSE, hist = TRUE, theme = "Set1")

## generating high resolution images also
rapport("example", ius2008, var="leisure", hist = TRUE, graph.hi.res = TRUE)
rapport.html("nortest", ius2008, var = "leisure", graph.hi.res=T)
## generating only high resolution image
rapport("example", ius2008, var="leisure", hist = TRUE, graph.width = 1280, graph.height = 1280)
## nested templates cannot get custom setting, use custom rapport option:
options('graph.hi.res' = TRUE)
rapport('descriptives-multivar', data=ius2008, vars=c("gender", 'age'))

Run the code above in your browser using DataLab