flextable_to_rmd: Knitr rendering in loops and if statements

View source: R/printers.R

flextable_to_rmdR Documentation

Knitr rendering in loops and if statements

Description

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.

Usage

flextable_to_rmd(x, ...)

Arguments

x

a flextable object

...

unused argument

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

## Not run: 
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"
  )
}

## End(Not run)

davidgohel/flextable documentation built on April 18, 2024, 11:37 a.m.