You may use the package-bundled templates with a minimal
R knowledge - a quick tutorial is shown in the package
demo: demo(rapport)
.
Apart from R, all you need to know to start writing your own templates is pandoc markup syntax, and several rapport-specific conventions that allow the reproducibility of the template. rapport uses brew-like tags to support dynamic inline and/or block evaluation of R code. Unlike many other report-writing conventions in R (Sweave, brew, knitr), rapport converts generated output to a convenient form via ascii package and appropriate preprocessing backend tools. rapport also comes with support for plots: images are automatically saved to temporary file, and image path is returned or redrawn on demand.
The output of rapport
command depends on various
package-specific options. Please skim through the summary
of following options:
tpl.user
: a (user)name to show in
exported report (defaults to"Anonymous"
)tpl.email
: a user's e-mail address to show in
exported report (defaults to an empty string).rapport.mode
defines the manner in whichrapport
evaluates the templates - by
default it is set tonormal
. Innormal
modelink{rapport}
would check all non-strict templates
(see:tpl.check
) "linewise", and that can
cause huge overhead, whileperformance
mode would
not perform cautious checks and evaluate all commands at
once. That is not a problem if you writestrict
templates, which is really advised.debug
mode is
appropriate for developers, as it will interrupt the
execution if template contains any errors.rapport
function saves plots to
image files (see the settings below) andprint
method just shows the path(s) of the generated image(s).
If you would like to see the plot(s) when callingrapport
function from an interactive R
console, please setgraph.record
andgraph.replay
options toTRUE
beforehand. In
that case all generated plots will be displayed after
printing therapport
object. These options are set
toFALSE
by default although we find these
settings really handy, as you can resize the images on
the fly and export resized images to HTML/ODT/DOCX/PDF
etc. If you would even like to save the actual
environment of each generated plot (variables, data sets
etc.) as anRData
file, please setgraph.save.env
toTRUE
.rapport
also has some options to set
formatting style of numbers, characters and dates. The
decimals needed for automatic rounding is defined inrp.decimal
andrp.decimal.short
options
which are by default set to4
and2
,
respectively. Inline numeric values are presented in a
short form, while the tables use the long form. The
decimal mark can be set easily to e.g.","
inrp.decimal.mark
option, and the date format can be
specified in POSIX format viarp.date.format
option.style.theme
which points to alattice
/trellis
theme, and uses
defaultrapporttheme:theme.rapport
. If you do not like this
minimalistic bluish theme, you might reconsider using
e.g.standard.theme()
fromlattice
,ggplot2like()
ortheEconomist.theme()
themes available inlatticeExtra
package or eithercustom.theme.black()
fromlatticist
package. Of course, custom theme might be provided too -
check out the?custom.theme
fromlatticeExtra
package or head directly to:trellis.par.get
.theme.rapport
can deal with a great number of
colour palettes. By default it usesdefault
theme
specified instyle.color.palette
option, which is
both print and colourblind-friendly palette (visitbrewer.pal.info
. If you would
like to get really colourful plots, you might consider
settingstyle.colorize
option toTRUE
as it
will choose random colours from a given palette for each
plot.rapport
tries to
generate images with Helvetica font family as it's a
neat, OS independent font. If you don't like that, you
can change thestyle.font
option. Note that you
might need to set the font family afterwards, especially
on Windows machines (seewindowsFonts
for
details).graph.grid
.
It is possible to render a grid for both axes
("both"
) or separate axes only ("x"
or"y"
)."none"
results in a blank background.rapport
function, and the resulting files
can be customised with several options:graph.format
option holds the plot output format:"png"
,"jpg"
,"bmp"
,"tiff"
,"svg"
or"pdf"
graph.width
andgraph.height
options hold settings for plot width
and height, respectivelygraph.res
sets the
default resolution in points per inch (ppi
). If
you would like to export images to high resolution
regardless of the specified dimensions, setgraph.hi.res
option toTRUE
. That can be
really handy in HTML exports as the images get "zoomable"
on click. Note: generating high resolution images has
some overhead as plots are generated twice.p
function concatenates vector values to a
nicely formatted string by using the values from global
options (see help page forp
for details).rp.tags
interesting, as it lets users to specify
custom tags forrapport
chunks. By changing
the default values you may create custom reports and use
your own syntax in custom templates. However,rapport