Draw a table from a data.frame
Description
Draw a table from a data.frame
Usage
datasummary_df(
data,
output = "default",
fmt = 2,
align = NULL,
hrule = NULL,
title = NULL,
notes = NULL,
add_rows = NULL,
add_columns = NULL,
escape = TRUE,
...
)
Arguments
data
|
A data.frame (or tibble) |
output
|
filename or object type (character string)
|
fmt
|
how to format numeric values: integer, user-supplied function, or
|
align
|
A string with a number of characters equal to the number of columns in the table (e.g.,
|
hrule
|
position of horizontal rules (integer vector) |
title
|
string |
notes
|
list or vector of notes to append to the bottom of the table. |
add_rows
|
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. |
add_columns
|
a data.frame (or tibble) with the same number of rows as your main table. |
escape
|
boolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)
|
…
|
all other arguments are passed through to the table-making functions tinytable::tt, 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.
|
References
Arel-Bundock V (2022). “modelsummary: Data and Model Summaries in R.” Journal of Statistical Software, 103(1), 1-23. .’