flextable is an R package that provides a grammar for creating and customizing beautiful tables for reporting and publication. With a single, consistent API you can produce tables for any output format — HTML, PDF, Microsoft Word, PowerPoint, RTF, or R grid graphics.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/davidgohel/flextable/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Create your first flextable in minutes
Installation
Install from CRAN or GitHub
Core Concepts
Understand how flextable works
API Reference
Browse the full function reference
Why flextable?
Most R table packages are tied to a single output format. flextable solves this by providing one API for all formats — the same code that creates your HTML report table also generates your Word document table.Multi-format
HTML, PDF, Word, PowerPoint, RTF, and R graphics — all from the same code
Fully customizable
Control every cell’s text, borders, colors, fonts, and alignment
R Markdown & Quarto
First-class integration with knitr chunk options
Statistical summaries
Built-in functions for model tables and cross-tabulations
Rich cell content
Embed images, equations, mini-charts, and ggplot2 plots in cells
Composable
Chain formatting verbs with the pipe operator
How it works
A flextable is built from adata.frame and consists of three parts: header, body, and footer. You apply formatting and layout transformations by chaining functions — similar to the dplyr or ggplot2 workflows familiar to R users.
Supported output formats
| Format | Function | Integration |
|---|---|---|
| Microsoft Word | save_as_docx() | officer, R Markdown, Quarto |
| Microsoft PowerPoint | save_as_pptx() | officer, R Markdown, Quarto |
| HTML | save_as_html() | R Markdown, Quarto, htmltools |
| PDF / LaTeX | (via knitr) | R Markdown, Quarto |
| RTF | save_as_rtf() | officer |
| PNG / SVG | save_as_image() | webshot2, magick |
| R grid | gen_grob() | patchwork |