Print flextable in R Markdown or Quarto documents
within for
loop or if
statement.
The function is particularly useful when you want to generate flextable in a loop from a R Markdown document.
Inside R Markdown document, chunk option results
must be
set to 'asis'.
See knit_print.flextable for more details.
See also
Other flextable print function:
as_raster()
,
df_printer()
,
gen_grob()
,
htmltools_value()
,
knit_print.flextable()
,
plot.flextable()
,
print.flextable()
,
save_as_docx()
,
save_as_html()
,
save_as_image()
,
save_as_pptx()
,
save_as_rtf()
,
to_html.flextable()
Examples
if (FALSE) { # \dontrun{
library(rmarkdown)
if (pandoc_available() &&
pandoc_version() > numeric_version("2")) {
demo_loop <- system.file(
package = "flextable",
"examples/rmd",
"loop_with_flextable.Rmd"
)
rmd_file <- tempfile(fileext = ".Rmd")
file.copy(demo_loop, to = rmd_file, overwrite = TRUE)
render(
input = rmd_file, output_format = "html_document",
output_file = "loop_with_flextable.html"
)
}
} # }