ascii (version 1.0)

export: Report creation

Description

Produce a report

Usage

export(..., list, file, format, open=TRUE, backend=getOption("asciiBackend"),
    encoding, options, cygwin=FALSE, title, author, email, date)

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

Value

  • Nothing

Details

Produce a report from a list of R objects. This function can be used directly, or through a Report proto object (see examples). Report$new() creates a new object, Report$export() produce a report. Options can be specified with Report$nameoftheoption <- option. Special objects can be used to create sections (see ?section) and paragraphs (see ?paragraph), and to insert graph (see ?graph) or inline results (see ?sexpr).

It needs a working installation of asciidoc, a2x tool chain, txt2tags, pandoc and/or markdown2pdf.

Examples

Run this code
options(asciiType = "asciidoc")
export(head(esoph))

r <- Report$new(author = "David Hajage", email = "dhajage at gmail dot com")
r$add(section("First section"))
r$add(section("First subsection", 2))
r$add(paragraph("The data set has", sexpr(nrow(esoph)), " lines. See yourself:"), esoph)
r$add(section("Second subsection: age and alc group", 2))
tab <- with(esoph, table(alcgp, agegp))
r$add(ascii(tab), ascii(summary(tab), format = "nice"))
r$export()
r$format <- "slidy"
r$export()

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$export()

r$backend <- "markdown2pdf"
r$format <- "pdf"
r$export()

Run the code above in your browser using DataCamp Workspace