# create an empty card
report <- teal_card()
# Create a card with content
report <- teal_card(
"## Headline",
"This is `iris` table",
code_chunk("print(iris)", lang = "R"),
iris
)
# Add elements to the report
report <- c(
report,
list("## mtcars Table"),
code_chunk("print(mtcars)", lang = "R"),
mtcars
)
# Subset the report to keep only the first two elements
report[1:2]
# Replace element
report[[1]] <- "## Iris Table"
# Append element
report <- append(report, teal_card("# Awesome Report"), after = 0)
tools::toHTML(report)
if (interactive()) {
render(report, output_format = rmarkdown::pdf_document())
}
Run the code above in your browser using DataLab