## 10.3 Other packages for creating tables

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 and huxtable : 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 : 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 : Provides some utility functions to format numbers (e.g., percent() and 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.

• DT : As its author, I think I’m familiar with this package, but I did not introduce it in a separate section because it only supports the HTML format. DT is built on top of the JavaScript library DataTables, which can turn a static table into an interactive table on an HTML page. You may sort, search, and paginate the table. DT also supports formatting the cells, works with Shiny to build interactive applications, and has included a large number of DataTables extensions (e.g., you may export the table to Excel, or interactively reorder columns). See the package repository for more information: https://github.com/rstudio/DT.

• reactable (Lin 2022): Similar to DT, this package also creates interactive tables based on a JavaScript library. Frankly speaking, it looks better than DT in several aspects in my eyes (such as row grouping and aggregation, and embedding HTML widgets). Had reactable existed in 2015, I would not have developed DT. That said, reactable does not contain all the features of DT, so you may read its documentation and see which one fits your purpose better: https://glin.github.io/reactable/.

• rhandsontable : Also similar to DT, and has an Excel feel (e.g., you can edit data directly in the table). Visit https://jrowen.github.io/rhandsontable/ to learn more about it.

• pixiedust : Features creating tables for models (such as linear models) converted through the broom package . It supports Markdown, HTML, and LaTeX output formats. Its repository is at https://github.com/nutterb/pixiedust.

• stargazer : Features formatting regression models and summary statistics tables. The package is available on CRAN at https://cran.r-project.org/package=stargazer.

• xtable : 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 , pander , tangram , ztable , and condformat .

### References

Dahl, David B., David Scott, Charles Roosen, Arni Magnusson, and Jonathan Swinton. 2019. Xtable: Export Tables to LaTeX or HTML. http://xtable.r-forge.r-project.org/.
Daróczi, Gergely, and Roman Tsegelskyi. 2022. Pander: An r Pandoc Writer. https://rapporter.github.io/pander/.
Garbett, Shawn. 2022. Tangram: The Grammar of Tables. https://github.com/spgarbet/tangram.
Gohel, David, and Panagiotis Skintzos. 2022. Flextable: Functions for Tabular Reporting. https://CRAN.R-project.org/package=flextable.
Hlavac, Marek. 2022. Stargazer: Well-Formatted Regression and Summary Statistics Tables.
Hugh-Jones, David. 2022. Huxtable: Easily Create and Style Tables for LaTeX, HTML and Other Formats. https://hughjonesd.github.io/huxtable/.
Iannone, Richard, Joe Cheng, Barret Schloerke, and Ellis Hughes. 2022. Gt: Easily Create Presentation-Ready Display Tables.
Lin, Greg. 2022. Reactable: Interactive Data Tables Based on React Table.
Moon, Keon-Woong. 2021. Ztable: Zebra-Striped Tables in LaTeX and HTML Formats. https://github.com/cardiomoon/ztable.
Murdoch, Duncan. 2022. Tables: Formula-Driven Table Generation. https://r-forge.r-project.org/projects/tables/.
Nutter, Benjamin. 2021. Pixiedust: Tables so Beautifully Fine-Tuned You Will Believe It’s Magic. https://github.com/nutterb/pixiedust.
Oller Moreno, Sergio. 2020. Condformat: Conditional Formatting in Data Frames. http://github.com/zeehio/condformat.
Owen, Jonathan. 2021. Rhandsontable: Interface to the Handsontable.js Library. http://jrowen.github.io/rhandsontable/.
Ren, Kun, and Kenton Russell. 2021. Formattable: Create Formattable Data Structures.
Robinson, David, Alex Hayes, and Simon Couch. 2022. Broom: Convert Statistical Objects into Tidy Tibbles.
Sjoberg, Daniel D., Michael Curry, Joseph Larmarange, Jessica Lavery, Karissa Whiting, and Emily C. Zabor. 2022. Gtsummary: Presentation-Ready Data Summary and Analytic Result Tables.
Xie, Yihui, Joe Cheng, and Xianying Tan. 2022. DT: A Wrapper of the JavaScript Library DataTables. https://github.com/rstudio/DT.

1. Frankly speaking, I rarely use tables by myself, so I’m not highly motivated to learn how to create sophisticated tables.↩︎

2. If you need the support for other output formats such as LaTeX and Word, the gtsummary package has made some extensions based on gt that look very promising: https://github.com/ddsjoberg/gtsummary.↩︎