Package: tinytable 0.6.1
tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats
Create highly customized tables with this simple and dependency-free package. Data frames can be converted to 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', or 'Typst' tables. The user interface is minimalist and easy to learn. The syntax is concise. 'HTML' tables can be customized using the flexible 'Bootstrap' framework, and 'LaTeX' code with the 'tabularray' package.
Authors:
tinytable_0.6.1.tar.gz
tinytable_0.6.1.tar.gz(r-4.5-noble)tinytable_0.6.1.tar.gz(r-4.4-noble)
tinytable_0.6.1.tgz(r-4.4-emscripten)tinytable_0.6.1.tgz(r-4.3-emscripten)
tinytable.pdf |tinytable.html✨
tinytable/json (API)
NEWS
# Install 'tinytable' in R: |
install.packages('tinytable', repos = 'https://cloud.r-project.org') |
Bug tracker:https://github.com/vincentarelbundock/tinytable/issues8 issues
Pkgdown site:https://vincentarelbundock.github.io
Last updated 2 months agofrom:94bc75779c. Checks:2 OK. Indexed: no.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Dec 25 2024 |
R-4.5-linux | OK | Dec 25 2024 |
Exports:colnamescolnames<-format_ttgroup_ttknit_print.tinytableplot_ttrbind2save_ttstyle_tttheme_tttt
Dependencies:
Citation
To cite package ‘tinytable’ in publications use:
Arel-Bundock V (2024). tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats. R package version 0.6.1, https://CRAN.R-project.org/package=tinytable.
Corresponding BibTeX entry:
@Manual{, title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats}, author = {Vincent Arel-Bundock}, year = {2024}, note = {R package version 0.6.1}, url = {https://CRAN.R-project.org/package=tinytable}, }
Readme and manuals
What?
tinytable
is a small but powerful R
package to draw beautiful tables
in a variety of formats: HTML, LaTeX, Word, 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/
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.[1]
-
Zero-dependency: Avoid importing any other
R
package.[2] - 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:
-
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 allowstinytable
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. -
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 likeBootstrap
for HTML andtabularray
for LaTeX. -
Lightweight is the right weight. Some of the most popular table-drawing packages in the
R
ecosystem are very heavy: A singlelibrary()
call can sometimes load upwards of 65R
packages. In contrast,tinytable
imports zero 3rd partyR
package by default.
Installation
tinytable
is a relatively new package with rapid development. If you
want to benefit from the latest features—showcased on the package
website—you should install from R-Universe:
install.packages("tinytable")
Alternatively, you can install it from CRAN:
install.packages("tinytable")
Restart R
completely for the installation to take effect.
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.5.0.5 tutorial will take you much further. It is
available in two formats:
- Tutorial (PDF)
- Tutorial (HTML):
[1] Other formats like Markdown and Typst are also available, but less flexible.
[2] 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.
Help Manual
Help page | Topics |
---|---|
Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats | tinytable-package tinytable |
Format columns of a data frame | format_tt |
Spanning labels to identify groups of rows or columns | group_tt |
Insert images and inline plots into tinytable objects | plot_tt |
Print, display, or convert a tinytable object | print.tinytable |
Combine 'tinytable' objects by rows (vertically) | rbind2 rbind2,tinytable,tinytable-method |
Save a Tiny Table to File | save_tt |
Style a Tiny Table | style_tt |
Themes for 'tinytable' | theme_tt |
Draw a Tiny Table | tt |