ascii (version 2.4)

createreport: Report creation

Description

Produce a report

Usage

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
)

Value

Nothing

Arguments

...

R objects (not used if "list" is not NULL)

list

list of R objects

file

name of the output file (without extension)

format

format of the output file

open

open resulting file?

backend

backend

encoding

encoding

options

other options

cygwin

use cygwin?

title

title of the report

author

author of the report

email

email of the author

date

date

Author

David Hajage

David Hajage

Details

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).

Examples

Run this code
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