add_chunk {chronicle}R Documentation

Transforms a function call into an Rmarkdown chunk

Description

Transforms a function call into an Rmarkdown chunk

Usage

add_chunk(
  report = "",
  fun,
  params,
  chunk_title = NULL,
  title_level = 2,
  echo = FALSE,
  message = FALSE,
  warning = FALSE,
  fig_width = NULL,
  fig_height = NULL,
  guess_title = TRUE
)

Arguments

report

Character string containing all the R Markdown chunks previously added. Default is ”, an empty report.

fun

Function to call.

params

List of parameters to be passed to fun.

chunk_title

Title of the Rmarkdown chunk. If NULL, chronicle will try to parse a generic title based on the function and parameters passed using make_title()

title_level

Level of the section title of this plot (ie, number of # on Rmarkdown syntax.)

echo

Whether to display the source code in the output document. Default is FALSE.

message

Whether to preserve messages on rendering. Default is FALSE.

warning

Whether to preserve warnings on rendering. Default is FALSE.

fig_width

Width of the plot (in inches).

fig_height

Height of the plot (in inches).

guess_title

If TRUE, tries to generate a generic title for chronicle::make_* family of functions (eg 'Sepal.Length vs Sepal.Width by Species' for make_scatter)

Value

An rmarkdown chunk as a character string.

Examples

library(chronicle)
html_chunk <- add_chunk(fun = chronicle::make_barplot,
                        params = list(dt = 'iris',
                                      value = 'Sepal.Width',
                                      bars = 'Species'))
cat(html_chunk)

[Package chronicle version 0.3 Index]