knitPrintListObjects {clinUtils} | R Documentation |
Include a list of objects in a knitr document
Description
Each object is included (internally) in a separated chunk, so different chunk options can be set for each object.
Usage
knitPrintListObjects(
xList,
generalLabel = "objectsList",
labels = paste0(generalLabel, seq_along(xList)),
titles = NULL,
titleLevel = 2,
printObject = FALSE,
...
)
Arguments
xList |
List of objects to print. |
generalLabel |
String with general label for the chunks,
used to build the |
labels |
Character vector with labels,
one for each chunk. |
titles |
Character vector with section titles, one for each chunk. |
titleLevel |
Integer with level for section header, 1 for top-level section header. |
printObject |
Logical, if TRUE (FALSE by default),
each object within |
... |
any |
Details
This function should be called within a chunk
with the following option: results = 'asis'
.
Value
No returned value, a text is printed with chunk content
Author(s)
Laure Cougnaud
Examples
## Not run:
# Note: the following code should be included
# within a chunk of a knitr (e.g. RMarkdown) document
# to include a list of objects in the Rmarkdown output
# list of flextable objects
library(flextable)
listTables <- list(flextable(iris), flextable(cars))
knitPrintListObjects(
xList = listTables,
titles = c("Iris dataset", "Cars dataset")
)
## End(Not run)