modelsummary
creates tables and plots to present descriptive statistics and to summarize statistical models in R
.
modelsummary is a package to summarize data and statistical models in R. It supports over one hundred types of models outofthebox, and allows users to report the results of those models sidebyside in a table, or in coefficient plots. It makes it easy to execute common tasks such as computing robust standard errors, adding significance stars, and manipulating coefficient and model labels. Beyond model summaries, the package also includes a suite of tools to produce highly flexible data summary tables, such as dataset overviews, correlation matrices, (multilevel) crosstabulations, and balance tables (also known as “Table 1”). The appearance of the tables produced by modelsummary can be customized using external packages such as kableExtra, gt, flextable, or huxtable; the plots can be customized using ggplot2. Tables can be exported to many output formats, including HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, Excel, RTF, PDF, and image files. Tables and plots can be embedded seamlessly in rmarkdown, knitr, or Sweave dynamic documents. The modelsummary package is designed to be simple, robust, modular, and extensible (ArelBundock, 2022).
modelsummary
includes two families of functions:
 Model Summary

modelsummary
: Regression tables with sidebyside models. 
modelplot
: Coefficient plots.

 Data Summary

datasummary
: Powerful tool to create (multilevel) crosstabs and data summaries. 
datasummary_crosstab
: Crosstabulations. 
datasummary_balance
: Balance tables with subgroup statistics and difference in means (aka “Table 1”). 
datasummary_correlation
: Correlation tables. 
datasummary_skim
: Quick overview (“skim”) of a dataset. 
datasummary_df
: Turn dataframes into nice tables with titles, notes, etc.

With these functions, you can create tables and plots like these:


Table of contents
The modelsummary
website hosts a ton of examples. Make sure you click on the links at the top of this page: https://modelsummary.com
Why should I use modelsummary
?
Here are a few benefits of modelsummary
over some alternative packages:
Easy
modelsummary
is very easy to use. This simple call often suffices:
library(modelsummary)
mod < lm(y ~ x, dat)
modelsummary(mod)
The command above will automatically display a summary table in the Rstudio
Viewer or in a web browser. All you need is one word to change the output format. For example, a textonly version of the table can be printed to the Console by typing:
modelsummary(mod, output = "markdown")
Tables in Microsoft Word and LaTeX formats can be saved to file by typing:
modelsummary(mod, output = "table.docx")
modelsummary(mod, output = "table.tex")
Flexible
Information: The package offers many intuitive and powerful utilities to customize the information reported in a summary table. You can rename, reorder, subset or omit parameter estimates; choose the set of goodnessoffit statistics to include; display various “robust” standard errors or confidence intervals; add titles, footnotes, or source notes; insert stars or custom characters to indicate levels of statistical significance; or add rows with supplemental information about your models.
Appearance: Thanks to the gt
, kableExtra
, huxtable
, flextable
, and DT
packages, the appearance of modelsummary
tables is endlessly customizable. The appearance customization page shows tables with colored cells, weird text, spanning column labels, row groups, titles, source notes, footnotes, significance stars, and more. This only scratches the surface of possibilities.
Supported models: Thanks to the broom
and parameters
, modelsummary
supports hundreds of statistical models outofthebox. Installing other packages can extend the capabilities further (e.g., broom.mixed
). It is also very easy to add or customize your own models.
Output formats: modelsummary
tables can be saved to HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, RTF, JPG, or PNG formats. They can also be inserted seamlessly in Rmarkdown documents to produce automated documents and reports in PDF, HTML, RTF, or Microsoft Word formats.
Dangerous
modelsummary
is dangerous! It allows users to do stupid stuff like replacing their intercepts by squirrels.
Reliable
modelsummary
is reliably dangerous! The package is developed using a suite of unit tests with about 95% coverage, so it (probably) won’t break.
Community
modelsummary
does not try to do everything. Instead, it leverages the incredible work of the R
community. By building on top of the broom
and parameters
packages, modelsummary
already supports hundreds of model types outofthebox. modelsummary
also supports five of the most popular tablebuilding and customization packages: gt
, kableExtra
, huxtable
, flextable
, and DT
packages. By using those packages, modelsummary
allows users to produce beautiful, endlessly customizable tables in a wide variety of formats, including HTML, PDF, LaTeX, Markdown, and MS Word.
One benefit of this communityfocused approach is that when external packages improve, modelsummary
improves as well. Another benefit is that leveraging external packages allows modelsummary
to have a massively simplified codebase (relative to other similar packages). This should improve long term code maintainability, and allow contributors to participate through GitHub.
Installation
You can install modelsummary
from CRAN:
install.packages('modelsummary')
You can install the development version of modelsummary
(and its dependency insight
) from RUniverse:
install.packages(
c("modelsummary", "insight", "performance", "parameters"),
repos = c(
"https://vincentarelbundock.runiverse.dev",
"https://easystats.runiverse.dev"))
Restart R
completely before moving on.
Getting started
There are a million ways to customize the tables and plots produced by modelsummary
. In this Getting Started section we will only scratch the surface. For details, see the vignettes:

modelsummary
: https://modelsummary.com/articles/modelsummary.html 
modelplot
: https://modelsummary.com/articles/modelplot.html 
datasummary
: https://modelsummary.com/articles/datasummary.html  Appearance: https://modelsummary.com/articles/appearance.html
To begin, load the modelsummary
package and download data from the Rdatasets archive:
library(modelsummary)
url < 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'
dat < read.csv(url)
dat$Small < dat$Pop1831 > median(dat$Pop1831)
Quick overview of the data:
datasummary_skim(dat)
Balance table (aka “Table 1”) with differences in means by subgroups:
datasummary_balance(~Small, dat)
Correlation table:
Two variables and two statistics, nested in subgroups:
datasummary(Literacy + Commerce ~ Small * (mean + sd), dat)
Estimate a linear model and display the results:
mod < lm(Donations ~ Crime_prop, data = dat)
modelsummary(mod)
Estimate five regression models, display the results sidebyside, and save them to a Microsoft Word document:
models < list(
"OLS 1" = lm(Donations ~ Literacy + Clergy, data = dat),
"Poisson 1" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat),
"OLS 2" = lm(Crime_pers ~ Literacy + Clergy, data = dat),
"Poisson 2" = glm(Crime_pers ~ Literacy + Commerce, family = poisson, data = dat),
"OLS 3" = lm(Crime_prop ~ Literacy + Clergy, data = dat)
)
modelsummary(models, output = "table.docx")