There are many other R packages that can be used to generate tables. The main reason that I introduced
kable() (Section 10.1) and kableExtra (Section 10.2) is not that they are better than other packages, but because I’m familiar with only them.14 Next I will list the packages that I’m aware of but not very familiar with. You can check them out by yourself, and decide which one fits your purpose best.
flextable (Gohel and Skintzos 2022) and huxtable (Hugh-Jones 2022): If you are looking for a table package that supports the widest range of output formats, flextable and huxtable are probably the two best choices. They all support HTML, LaTeX, and Office formats, and contain most common table features (e.g., conditional formatting). More information about flextable can be found at https://davidgohel.github.io/flextable/, and the documentation of huxtable is at https://hughjonesd.github.io/huxtable/.
gt (Iannone et al. 2022): Allows you to compose a table by putting together different parts of the table, such as the table header (title and subtitle), the column labels, the table body, row group labels, and the table footer. Some parts are optional. You can also format numbers and add background shading to cells. Currently gt mainly supports HTML output.15 You can find more information about it at https://gt.rstudio.com.
formattable (Ren and Russell 2021): Provides some utility functions to format numbers (e.g.,
accounting()), and also functions to style table columns (e.g., format the text, annotate numbers with background shading or color bars, or add icons in cells). Like gt, this package also primarily supports the HTML format. You can find more information about it from its GitHub project at https://github.com/renkun-ken/formattable.
pixiedust (Nutter 2021): Features creating tables for models (such as linear models) converted through the broom package (Robinson, Hayes, and Couch 2022). It supports Markdown, HTML, and LaTeX output formats. Its repository is at https://github.com/nutterb/pixiedust.
xtable (Dahl et al. 2019): Perhaps the oldest package for creating tables—the first release was made in 2000. It supports both LaTeX and HTML formats. The package is available on CRAN at https://cran.r-project.org/package=xtable.
I’m not going to introduce the rest of packages, but will just list them here: tables (Murdoch 2022), pander (Daróczi and Tsegelskyi 2022), tangram (S. Garbett 2022), ztable (Moon 2021), and condformat (Oller Moreno 2020).
Frankly speaking, I rarely use tables by myself, so I’m not highly motivated to learn how to create sophisticated tables.↩︎
If you need the support for other output formats such as LaTeX and Word, the gtsummary package (Sjoberg et al. 2022) has made some extensions based on gt that look very promising: https://github.com/ddsjoberg/gtsummary.↩︎