Learn R Programming

What?

tinytable is a small but powerful R package to draw beautiful tables in a variety of formats: HTML, LaTeX, Word[^1], PDF, PNG, Markdown, and Typst. The user interface is minimalist and easy to learn, while giving users access to powerful frameworks to create endlessly customizable tables.

https://vincentarelbundock.github.io/tinytable/

[!NOTE]

The documentation on this website uses the latest development version of tinytable. This version can normally be installed from R-Universe:

install.packages('tinytable', repos = c('https://vincentarelbundock.r-universe.dev', 'https://cloud.r-project.org'))

or from Github:

remotes::install_github("vincentarelbundock/tinytable")

Remember to restart R completely after installation, to ensure that the latest version is loaded.

The documentation for the current version of tinytable is available on the CRAN package page.

Why?

There are already many excellent table-drawing packages in the R ecosystem. Why release a new one? As the maintainer of modelsummary, I needed a table-drawing package which was:

  • Simple: Streamlined, consistent, and uncluttered user interface, with few functions to learn.
  • Flexible: Expressive frameworks to customize tables in HTML and LaTeX formats.[^2]
  • Zero-dependency: Avoid importing any other R package.[^3]
  • Concise: Draw beautiful tables without typing a lot of code.
  • Safe: User inputs are checked thoroughly, and informative errors are returned early.
  • Maintainable: A small code base which does not rely on too many complex regular expressions.
  • Readable: HTML and LaTeX code should be human-readable and editable.
  • Free: This package will always be free. Tiny tables for a tiny price!

To achieve these goals, the design philosophy of tinytable rests on three pillars:

  1. Data is separate from style. The code that this package creates keeps the content of a table separate from the style sheet that applies to its cells. This is in contrast to other R packages that modify the actual text in each cell to style it. Keeping data and style separate allows tinytable to create human-readable files which are easy to edit, debug, and extend. It also enables developers to keep a simpler code base, with minimal use of messy regular expressions.

  2. Flexibility. Users’ needs are extremely varied, and a table-drawing package must be flexible enough to accomodate different ideas. To achieve this, tinytable builds on battle-tested and versatile frameworks like Bootstrap for HTML and tabularray for LaTeX.

  3. Lightweight. Some of the most popular table-drawing packages in the R ecosystem are very heavy: A single library() call can sometimes load upwards of 65 R packages. In contrast, tinytable imports zero 3rd party R package by default.

First steps

The best feature of tinytable is its simplicity. To draw a table, simply call the tt() function with your data frame as the first argument:

library(tinytable)

x <- mtcars[1:5, 1:5]

tt(x)

More complex tables can be created by calling arguments and chaining functions together. In the next example, we add a caption, footnote, colors, styles, and spanning column headers:

cap <- "A simple \\texttt{tinytable} example."
not <- "Nullam odio est, ullamcorper scelerisque lectus a, eleifend luctus nisl. Etiam ullamcorper, nibh vel interdum auctor, odio nulla mollis tortor, vel fringilla ante quam quis est."

tt(x, 
   caption = cap, 
   notes = not, 
   width = .5) |> 
 style_tt(
   i = 1:3,
   j = 1:2,
   background = "teal",
   color = "white",
   bold = TRUE) |>
 group_tt(
   j = list("Halloumi" = 1:2, "Tofu" = 4:5))

Tutorial

The tinytable 0.12.0.4 tutorial will take you much further. It is available in two formats:

[^1]: Styling options in Word are somewhat limited. See the FAQ page and the style_tt() documentation for details.

[^2]: Other formats like Markdown and Typst are also available, but less flexible.

[^3]: Some extra packages can be imported to access specific functionality, such as integration with Quarto, inserting ggplot2 objects as inline plots, and saving tables to PNG images or PDF documents.

Copy Link

Version

Install

install.packages('tinytable')

Monthly Downloads

16,711

Version

0.13.0

License

GPL (>= 3)

Maintainer

Vincent Arel-Bundock

Last Published

August 19th, 2025

Functions in tinytable (0.13.0)

initialize,tinytable-method

Method for a tinytable S4 object
save_tt

Save a Tiny Table to File
style_eval

Apply style settings to a tinytable
style_tt

Style a Tiny Table
theme_revealjs

RevealJS presentation theme
theme_rotate

Rotate table theme (LaTeX and Typst only)
plot_tt

Insert images and inline plots into tinytable objects
nrow,tinytable-method

Method for a tinytable S4 object
style_eval,tinytable_grid-method

tinytable S4 method
names,tinytable-method

Method for a tinytable S4 object
theme_tt

Deprecated: Use format-specific theme functions instead
strip_tt

Strip elements from a Tiny Table
theme_striped

Striped theme with alternating row colors
theme_html

HTML-specific styles and options
theme_latex

LaTeX-Specific Theme for tinytable
tt

Draw a Tiny Table
ncol,tinytable-method

Method for a tinytable S4 object
rbind2,tinytable,tinytable-method

Combine tinytable objects by rows (vertically)
print.tinytable

Print, display, or convert a tinytable object
group_eval_j,tinytable_grid-method

tinytable S4 method
theme_default

Default theme for TinyTable
theme_typst

Typst-specific styles and options
theme_void

Theme for a void table
tinytable-class

tinytable S4 class
theme_grid

Grid theme with borders around all cells
tinytable-package

tools:::Rd_package_title("tinytable")
as.character,tinytable-method

Convert a tinytable S4 object to a string
build_eval

Apply group settings to a tinytable
colnames<-,tinytable-method

Method for a tinytable S4 object
colnames,tinytable-method

Method for a tinytable S4 object
finalize

Apply final settings to a tinytable
format_tt

Format columns of a data frame
dim,tinytable-method

Dimensions a tinytable S4 object
df_to_json

Convert data frame or list to JSON
group_eval_j,tinytable_typst-method

tinytable S4 method
finalize,tinytable_dataframe-method

tinytable S4 method
group_eval_j,tinytable_bootstrap-method

tinytable S4 method
group_eval_j

Apply group settings to a tinytable
group_eval_j,tinytable_dataframe-method

tinytable S4 method
group_tt

Spanning labels to identify groups of rows or columns
names<-,tinytable-method

Method for a tinytable S4 object
knit_print.tinytable

Print a tinytable object in knitr
group_eval_j,tinytable_tabularray-method

tinytable S4 method
group_eval_j,tinytable_tabulator-method

tinytable S4 method
style_eval,tinytable_dataframe-method

tinytable S4 method