listdown: Create a listdown Object

View source: R/chunk-writer.r

listdownR Documentation

Create a listdown Object

Description

A listdown object provides information for how a presentation list should be used to create an R Markdown document. It requires an unquoted expression indicating how the presentation list will be loaded. In addition, libraries required by the outputted document and other parameters can be specified.

Usage

listdown(
  package = NULL,
  decorator = list(),
  decorator_chunk_opts = list(),
  default_decorator = identity,
  setup_expr = NULL,
  init_expr = NULL,
  load_cc_expr = NULL,
  ...,
  chunk_opts = NULL
)

Arguments

package

a quoted list of package required by the outputted document.

decorator

a named list mapping the potential types of list elements to a decorator function.

decorator_chunk_opts

a named list mapping the potential types of list elements to chunk options that should be included for those types.

default_decorator

the decorator to use for list elements whose type is not inherited from the decorator list. If NULL then the those elements will not be included when the chunks are written. By default this is identity, meaning that the elements will be passed directly (through the identity() function).

setup_expr

an expression that is added before package are loaded. The expression is put into a chunk named 'setup' with option 'include = FALSE' and is intended for initializing the document. For example the expression 'knitr::opts_chunk$set(echo = FALSE)' could be used to turn echo'ing off for the entire document.

init_expr

an initial expression that will be added to the outputted document after the libraries have been called. This expression appears after packages are loaded and before data is read.

load_cc_expr

either an unquoted expression or a character string that will be turned into an unquoted expression via str2lang to load the presentation list.

...

default options sent to the chunks of the outputted document.

chunk_opts

a named list of options sent to the chunks of outputted documents. Note: takes priority over argument provided to ...

Value

An S3 object of type 'listdown'

  • load_cc_expr - the R expression to load computational components.

  • decorator - the list element decorators.

  • package - package dependencies for the document.

  • init_expr - the R expression to run initially.

  • setup_expr - the R expression to run on setup.

  • decorator_chunk_options - the R Markdown chunk options.

  • default_decorator - the set of default decorators.

  • chunk_opts - the default R Markdown chunk options.

Examples

library(ggplot2)
cc <- list(
    iris = iris,
     Sepal.Length = list(
       Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
            geom_point(),
       Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
            geom_point(),
     Colored = list(
          Sepal.Width = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width,
            color = Species)) + geom_point(),
          Petal.Length = ggplot(iris, aes(x = Sepal.Length, y = Petal.Length,
            color = Species)) + geom_point())))

header <- ld_rmarkdown_header("Test header", author = "Some Dude",
                              date = "2020")

ld <- listdown(package = "ggplot2")

ld_bundle_doc(cc, header, ld)

listdown documentation built on April 3, 2023, 5:42 p.m.

Related to listdown in listdown...