Learn R Programming

rapport (version 1.1)

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 rapport.inputs for more details on template inputs.

Usage

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

Arguments

fp

a template file pointer (see rapport:::rapport.read for details)

data

a data.frame to be used in template

...

matches template inputs in format 'key = "value"'

env

the parent environment to be forked, in which temporary new.env template commands be evaluated

reproducible

a logical value indicating if the call and data should be stored in template object, thus making it reproducible (see rapport.rerun for details)

header.levels.offset

number added to header levels (handy when using nested templates)

graph.output

the required file format of saved plots (optional)

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-increment integer based on similar (plot) file names (see: ?evalsOptions), %T by the name of the template in action and %t by some uniqe random characters based on tempfile.

file.path

path of a directory where to store generated images and exported reports

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:

  • 'rapport.file.name',

  • 'rapport.file.path',

See Also

rapport-package

Examples

Run this code
# NOT RUN {
rapport('Example', ius2008, v = "leisure")
rapport('Descriptives', ius2008, var = "leisure")

## generating high resolution images also
rapport('Example', ius2008, v = "leisure", graph.hi.res = TRUE)
rapport.html('NormalityTest', ius2008, var = "leisure", graph.hi.res=T)
## generating only high resolution image
rapport('Example', ius2008, v = "leisure", graph.width = 1280, graph.height = 1280)
## nested templates cannot get custom setting, use custom rapport option:
options('graph.hi.res' = TRUE)
rapport('AnalyzeWizard', data=ius2008, variables=c('edu', 'game'))
# }

Run the code above in your browser using DataLab