Skip to contents

This function was inspired by the excellent skimr package for R. See the Details and Examples sections below, and the vignettes on the modelsummary website:




  type = "numeric",
  output = "default",
  fmt = "%.1f",
  histogram = TRUE,
  title = NULL,
  notes = NULL,
  align = NULL,
  escape = TRUE,



A data.frame (or tibble)


of variables to summarize: "numeric" or "categorical" (character)


filename or object type (character string)

  • Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg

  • Supported object types: "default", "html", "markdown", "latex", "latex_tabular", "data.frame", "gt", "kableExtra", "huxtable", "flextable", "DT", "jupyter". The "modelsummary_list" value produces a lightweight object which can be saved and fed back to the modelsummary function.

  • The "default" output format can be set to "kableExtra", "gt", "flextable", "huxtable", "DT", or "markdown"

    • If the user does not choose a default value, the packages listed above are tried in sequence.

    • Session-specific configuration: options("modelsummary_factory_default" = "gt")

    • Persistent configuration: config_modelsummary(output = "markdown")

  • Warning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the 'Details' section.

  • LaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the 'Details' section.


how to format numeric values: integer, user-supplied function, or modelsummary function.

  • Integer: Number of decimal digits

  • User-supplied functions:

    • Any function which accepts a numeric vector and returns a character vector of the same length.

  • modelsummary functions:

    • fmt = fmt_significant(2): Two significant digits (at the term-level)

    • fmt = fmt_sprintf("%.3f"): See ?sprintf

    • fmt = fmt_identity(): unformatted raw values


include a histogram (TRUE/FALSE). Supported for:

  • type = "numeric"

  • output is "html", "default", "jpg", "png", or "kableExtra"

  • PDF and HTML documents compiled via Rmarkdown or knitr

  • See the examples section below for an example of how to use datasummary to include histograms in other formats such as markdown.




list or vector of notes to append to the bottom of the table.


A string with a number of characters equal to the number of columns in the table (e.g., align = "lcc"). Valid characters: l, c, r, d.

  • "l": left-aligned column

  • "c": centered column

  • "r": right-aligned column

  • "d": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. These commands must appear in the LaTeX preamble (they are added automatically when compiling Rmarkdown documents to PDF):

    • \usepackage{booktabs}

    • \usepackage{siunitx}

    • \newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]}


boolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. This setting does not affect captions or notes.


all other arguments are passed through to the table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.

Global Options

The behavior of modelsummary can be modified by setting global options. For example:

  • options(modelsummary_model_labels = "roman")

The rest of this section describes each of the options above.

Model labels: default column names

These global option changes the style of the default column headers:

  • options(modelsummary_model_labels = "roman")

  • options(modelsummary_panel_labels = "roman")

The supported styles are: "model", "panel", "arabic", "letters", "roman", "(arabic)", "(letters)", "(roman)""

The panel-specific option is only used when shape="rbind"

Table-making packages

modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. For example, 3 of those packages can export to LaTeX. To change the default backend used for a specific file format, you can use the options function:

options(modelsummary_factory_html = 'kableExtra')

options(modelsummary_factory_latex = 'gt')

options(modelsummary_factory_word = 'huxtable')

options(modelsummary_factory_png = 'gt')

Table themes

Change the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette:

  • modelsummary_theme_gt

  • modelsummary_theme_kableExtra

  • modelsummary_theme_huxtable

  • modelsummary_theme_flextable

  • modelsummary_theme_dataframe

Model extraction functions

modelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:

options(modelsummary_get = "broom")

options(modelsummary_get = "easystats")

options(modelsummary_get = "all")

Formatting numeric entries

By default, LaTeX tables enclose all numeric entries in the \num{} command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:

options(modelsummary_format_numeric_latex = "plain")

options(modelsummary_format_numeric_latex = "mathmode")

A similar option can be used to display numerical entries using MathJax in HTML tables:

options(modelsummary_format_numeric_html = "mathjax")


dat <- mtcars
dat$vs <- as.logical(dat$vs)
dat$cyl <- as.factor(dat$cyl)

Unique (#) Missing ( Mean SD Min Median Max
mpg 25 0 20.1 6.0 10.4 19.2 33.9
disp 27 0 230.7 123.9 71.1 196.3 472.0
hp 22 0 146.7 68.6 52.0 123.0 335.0
drat 22 0 3.6 0.5 2.8 3.7 4.9
wt 29 0 3.2 1.0 1.5 3.3 5.4
qsec 30 0 17.8 1.8 14.5 17.7 22.9
am 2 0 0.4 0.5 0.0 0.0 1.0
gear 3 0 3.7 0.7 3.0 4.0 5.0
carb 6 0 2.8 1.6 1.0 2.0 8.0

datasummary_skim(dat, "categorical")

cyl 4 11 34.4
6 7 21.9
8 14 43.8
vs FALSE 18 56.2
TRUE 14 43.8

# You can use `datasummary` to produce a similar table in different formats.
# Note that the `Histogram` function relies on unicode characters. These
# characters will only display correctly in some operating systems, under some
# locales, using some fonts. Displaying such histograms on Windows computers
# is notoriously tricky. The `modelsummary` authors cannot provide support to
# display these unicode histograms.

f <- All(mtcars) ~ Mean + SD + Min + Median + Max + Histogram
# datasummary(f, mtcars, output="markdown")


Arel-Bundock V (2022). “modelsummary: Data and Model Summaries in R.” Journal of Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'