Learn R Programming

chronicle (version 0.1.0)

add_table: Add a table to a chronicle report

Description

Add a table to a chronicle report

Usage

add_table(
  report = new_report(),
  table,
  table_title = NULL,
  title_level = 2,
  html_table_type = c("DT", "kable"),
  table_params = NULL
)

Arguments

report

character containing the text of an Rmarkdown report header (and possibly more chunks). Easily create one with chronicle::new_report()

table

data.frame to print on the report.

table_title

title of the table. Default is no title.

title_level

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

html_table_type

Either print a knitr::kable table or a DT htmlwidget. kable tables look good with prettydoc (which is TRUE by default on new_report()), DT (https://rstudio.github.io/DT/) are interactive table widgets.

table_params

Single character string with any additional parameters to be passed to either knitr::kable() or DT::datatable(), depending on html_table_type

Value

An R Markdown file as a character string, now containing a chunk for the specified table.

Examples

Run this code
# NOT RUN {
html_report <- add_table(report = new_report(),
                         table = iris,
                         table_title = 'Iris measures',
                         html_table_type = 'kable')
cat(html_report)
# }

Run the code above in your browser using DataLab