tblDown: Write data frames in a document

View source: R/tblDown.R

tblDownR Documentation

Write data frames in a document

Description

Write a data frame or a list of data frames in a markdown document converted #' in various format using pandoc.

Usage

tblDown(
  x,
  output_file = "./tables.docx",
  section = NULL,
  caption = NULL,
  title = NULL,
  row.names = FALSE,
  ...
)

Arguments

x

a data frame or a list of data frames.

output_file

path to the output file. Its extension will be used by pandoc to correctly render the final document in the write format.

section

a vector of character strings used as section titles (optional).

caption

a vector of character strings used as captions (optional).

title

a character string used as a title for the document (optional).

row.names

a logical. Should row names be added? See knitr::kable().

...

further arguments passed to knitr::kable().

Details

This function calls base::cat() and knitr::kable() to write a Markdown document containing a list of tables that is then converted into the desired format. For section and caption if the length differ then will be cut off or expanded.

Value

A data frame whose columns have the desired classes.

References

https://pandoc.org/MANUAL.html#tables

Examples

## Not run: 
data(CO2)
tblDown(list(CO2[1:2, ], CO2[3:6,]), section = "section")
tblDown(list(CO2[1:2, ], CO2[3:6,]), "./tables.pdf")

## End(Not run)

letiR/letiRmisc documentation built on Sept. 11, 2022, 12:43 a.m.