Skip to contents

Draw a table from a data.frame


  output = "default",
  fmt = 2,
  align = NULL,
  hrule = NULL,
  title = NULL,
  notes = NULL,
  add_rows = NULL,
  add_columns = NULL,
  escape = TRUE,



A data.frame (or tibble)


filename or object type (character string)

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

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

  • 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.

  • The default output formats and table-making packages can be modified with global options. See the 'Details' section.


determines how to format numeric values

  • integer: the number of digits to keep after the period format(round(x, fmt), nsmall=fmt)

  • character: passed to the sprintf function (e.g., '%.3f' keeps 3 digits with trailing zero). See ?sprintf

  • function: returns a formatted character string.

  • NULL: does not format numbers, which allows users to include function in the "glue" strings in the estimate and statistic arguments.


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. Only supported for LaTeX/PDF tables produced by kableExtra. 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-symbols = ()]}


position of horizontal rules (integer vector)




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


a data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a "position" attribute of integers to set the row positions. See Examples section below.


a data.frame (or tibble) with the same number of rows as your main table.


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 or gt::gt, 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.


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 .'