
Produce a report
createreport(
...,
list = NULL,
file = NULL,
format = NULL,
open = TRUE,
backend = getOption("asciiBackend"),
encoding = NULL,
options = NULL,
cygwin = FALSE,
title = NULL,
author = NULL,
email = NULL,
date = NULL
)
Nothing
R objects (not used if "list"
is not NULL)
list of R objects
name of the output file (without extension)
format of the output file
open resulting file?
backend
encoding
other options
use cygwin?
title of the report
author of the report
email of the author
date
David Hajage
Produce a report from a list of R objects. This function can be
used directly, or through a Report
object (see
examples). Report$new()
creates a new object,
Report$create()
produce a report. Exportation options can
be specified with Report$nameoftheoption <- option
or
directly in Report$create(nameoftheoption = option)
.
Special objects can be used to create sections (see
?section
), paragraphs (see ?paragraph
), verbatim
environment (see ?verbatim
and to insert figures (see
?fig
) or inline results (see ?sexpr
). Helpers exist:
Report$addSection()
, Report$addParagraph()
,
Report$addVerbatim()
, Report$addFig()
.
It needs a working installation of asciidoc, a2x tool chain, txt2tags and/or pandoc (NB: markdown2pdf uses pandoc with latex).
if (FALSE) {
op <- options(asciiType = "asciidoc")
createreport(head(esoph))
r <- Report$new(author = "David Hajage", email = "dhajage at gmail dot com")
r$add(section("First section"))
r$addSection("First subsection", 2)
r$add(paragraph("The data set has", sexpr(nrow(esoph)), " lines. See yourself:"), esoph)
r$addSection("Second subsection: age and alc group", 2)
tab <- with(esoph, table(alcgp, agegp))
r$add(ascii(tab), ascii(summary(tab), format = "nice"))
r$create()
r$format <- "slidy"
r$create()
r$title <- "R report example"
r$author <- "David Hajage"
r$email <- "dhajage at gmail dot com"
options(asciiType = "pandoc")
r$backend <- "pandoc"
r$format <- "odt"
r$create()
r$create(backend = "markdown2pdf", format = "pdf")
options(op)
}
Run the code above in your browser using DataLab