vcov_type when the user supplies a string.
“classical” becomes “Classical” instead of “IID”, etc.dvnames(skip=). Thanks to @raffaem for
report #933.datasummary_skim() in Quarto no longer escapes \num{} and
underscores twice. Fixes Issue #939.modelsummary_model_labels_termmodelsummary_model_labels_groupmodelsummary_model_labels_modeldatasummary_balance() gains a fn argument (and
modelsummary_balance_fn option) to supply custom summary functions
for numeric variables. When fn is supplied and the data includes
weights, weights are ignored with a warning. Defaults remain Mean
and Std. Dev.output="tinytable". Thanks to @mvuorre for report #886.coef_rename when
users specify component in the shape argument. Thanks to @raffaem
for report #892.flextable output uses hline instead of border. This fixes report
#693 from the flextable Github issue tracker. Thanks to @davidgohel
for the fix.get_estimates(), get_gof() and modelsummary() gets a
“backend” attribute with info about the extraction method. Thanks to
@raffaem for contribution #914.get_estimates() and get_gof() gets a “backend” attribute
with info about the extraction method. Thanks to @raffaem for
contribution #914.tinytable 0.13.0, which fixes Issue #912.flextable: Added support for spanning headers in modelsummary(),
datasummary(), and other functions, matching the functionality
available in tinytable.exponentiate=TRUE. Thanks to @raffaem for report #896.New:
add_rows: The position of new rows can be set using a “position”
attribute. Previously, this only accepted integers. Now we accept
string shortcuts:
attr(new_rows, "coef_start")attr(new_rows, "coef_end")attr(new_rows, "gof_start")attr(new_rows, "gof_end")tinytable-style note specification:
notes=list(a = list(i = 0:1, j = 1, text = "Blah.")). Thanks to
@sverrirarnors for feature request #867.exponentiate=TRUE no longer exponentiates parameters that are marked
as “random” in the “effect” column when calling get_estimates().
Thanks to @orvaquim for report #878.Bug:
modelplot() accepts linewidth argument. Thanks to @trekonom for
report #861.add_rows. Thanks to @judgelord for
report #875.fmt_equivalence(). Thanks to Nicholas Astier for the
report and bugfix.tinytable::style_tt() is now documented in
a the Themes and Styles vignette.datasummary_correlation(). Thanks to
@mvuorre for report #860.Breaking change:
modelsummary(models, shape = "rbind") does not insert panel names by
default. Instead, the panel names are taken from the names of the top
level list of lists. Thanks to @raffaem for feature request #849.Bugs:
kableExtra escaped \num{} in LaTeX.add_rows. Thanks to @pyoungblood
for Issue #813.shape creates bad columns when model names include spaces. Thanks to
@daSilva5 for report #816.datasummary_balance().
Thanks to @kleuveld for report #840.New features:
labelled and
sjlabelled packages.tinytable, parameters, and
insight dependencies.coef_rename() gets a poly=TRUE argument to rename
poly(x, 2)-style coefficients. Thanks to @mccarthy-m-g for code
contribution #778.get_gof(): logLik column converted to numeric for consistent
types. Issue 649 reported on the mice Github.kableExtra update the siunitx commands for d columns.kableExtra escapes footnotes in HTML when output="kableExtra").
Thanks to @dmurdoch and @michaelherndon97 for report #793.fmt_equivalence() function to implement the rounding suggestion
of Astier & Wolak (2024). Thanks to Nicolas Astier for code prototype.datasummary_*() tables. No
change in behavior. Thanks to @fkohrt for report #804.Bugs:
datasummary_*() functions can be called as arguments in another
datasummary_*() arguments, like add_columns. Thanks to @mronkko
for report #799caption instead of title. Inconsistency
with respect to tinytable.title argument.htest workaround.Bugs:
datasummary_correlation() respects the escape argument. Issue
#772.datasummary_correlation() supports data.table objects. Issue
#771.New:
modelsummary() gets a gof_function argument which accepts
functions to extract custom information from models.flextable: Support spanning column headersdatasummary_correlation() gets a star argument.datasummary_correlation() accepts objects produced by the
correlation package.datasummary_balance(): formula can now include variables on the
left-hand side to indicate the subset of columns to summarize:
datasummary_balance(mpg + hp ~ am, data = mtcars) Thanks to
@etiennebacher for feature request #751.tinytable 0.3.0Bugs:
escape argument not respected in datasummary_df(). Thanks to
@adamaltmejd for report #740datasummary_correlation() supports data.table. Thanks to
volatilehead on Twitter for report #737.estimate argument when using shape and statistics are
horizontal. Thanks to @iago-pssjd for report #745.datasummary().
Thanks to @marklhc for report #752.coef_map does not work when there is a group. Thanks to
@mccarthy-m-g for report #757.kableExtra: fix spanning column headers when using the shape
argument.tinytable output. Thanks toMAJOR BREAKING CHANGE: The default output format is now tinytable
instead of kableExtra. Learn more about tinytable here:
https://vincentarelbundock.github.io/tinytable/
To revert to the previous behavior persistently, users can call:
library(modelsummary) config_modelsummary(factory_default = “kableExtra”)
Other breaking changes:
statistic_override argument was replaced by vcov over 1 year
ago, with appropriate deprecation warnings. It is now fully removed.group argument was replaced by shape several releases ago. It
is now fully removed.datasummary_skim()
tinytable backend. This
allows a lot of code simplification and more customization.type and output is switched for
consistency with other functions.histogram argument is deprecated.New features:
datasummary_skim():
type="all" by default to display both numeric and categorical
variables in a single table with distinct panels. This feature is
only available with the tinytable backend (default).by argument allows summarizing numeric variables by group.fun_numeric argument accepts a list of functions to control the
summary columns.modelsummary():
statistic and estimate can be specified as named vectors to
control the names of statistics when displayed in different columns
using the shape argument. (Thanks to @mps9506 for bug report
#722)modelsummary(panels, shape = "cbind") automatically adds
column-spanning labels when panels is a named nested list of
models.config_modelsummary() gets a startup_message argument to silence
the startup message persistently.Bug fixes:
modelplot() calls. Thanks
to @iago-pssjd for the report and @florence-laflamme for the fix.tinytable supports histograms in datasummary_skim()config_modelsummary() supports tinytable factory.tinytable package as an output format (“factory”):
https://vincentarelbundock.github.io/tinytable/md output format is recognized.options(modelsummary_factory_default) is respected, even in qmd->md
documents.Bugs:
I() operator in formulas. Issue
#693.Misc:
shape groups are removed automatically for
cleaner labels.Bugs:
kableExtra. Issue #669.New:
Typst output, with auto-detection in Quarto
documents.strip argument in dvnames.s.value statistic is now available whenever p.value is available.
See Greenland (2019).datasummary_skim() now includes histograms in gt tables.Bugs:
furrr generated errors for some models. Thanks to
@sammo3182 for Issue #647.New:
fmt_sci() can now be used in the fmt argument for rounding with
scientific notation.Bugs:
add_rows with shape="rbind". Thanks to
@lrose1 for Report #626.shape and grouped estimates.
Thanks to @iago-pssjd for Report #631.coef_rename=TRUE bug with grouped estimates. Thanks to @iago-pssjd
for Report #631.parameters meant that vcov was no longer
used for confidence intervals.kableExtra. Recommends an additional
install for other formats.config_modelsummary(factory_default = "gt")shape = "rcollapse" and shape = "rbind"glance_custom() can drop GOF by assigning NA:
https://stackoverflow.com/questions/75215355/assigning-different-coefficient-names-and-goodness-of-fit-statistics-to-differenstatistic is not available, modelsummary prints an empty
cell instead of returning an error.title even when escape=TRUEfixest_multi objects supported.options(modelsummary_future = FALSE) disables future parallelism.Bug fixes:
statistic=NULL is now respected when shape="rbind". Thanks to
Panos Mavros for report #620.get_estimates() supports vcov string shortcuts and formulas.
Thanks to @ethans-carl for report #605.situnix in header
automatically for decimal alignement with align="ddd"escape is now respected by modelsummary with shape="rbind".
Thanks to @chickymonkeys for report #622.Breaking change:
modelsummary() has changed from
“Model 1” to “(1)”. The benefits are: labels are no longer in English
by default; use less horizontal space; eliminate the “Model”
redundancy. Unfortunately, this could break code in some edge cases
where users rely on column names to manipulate tables. The old
behavior can be restored by calling:
options(modelsummary_model_labels="model")New features:
shape="rbind" to stack multiple regression tables and create
“panels” with labelled groups of models.fmt: new helper functions for different formatting styles
fmt = fmt_decimal(2): decimal digitsfmt = fmt_decimal(digits = 2, pdigits = 4): decimal digits with p
value-specific settingfmt = fmt_sprintf("%.3f"): sprintf() decimalfmt = fmt_sprintf("%.3e"): sprintf() scientificfmt = fmt_significant(3): significant digitsfmt = fmt_statistic("estimate" = 2, "std.error" = 3):
statistic-specific formattingfmt = fmt_term("(Intercept)" = 2, "hp" = 3): term-specific
formattingfmt = fmt_identity(): raw valuesmodelsummary, such as Roman
Numerals or letters in parentheses.
options(modelsummary_model_labels = "roman")modelplot(draw = FALSE) now returns a p.value column. This allows
conditional aesthetics (see the modelplot vignette).marginaleffects package.Bugs:
fixest models returns useless “group.x” and “group.y” columns.
Isse #591. Thanks to Adam Altmejd for the report.Breaking change:
shape and output="dataframe" arguments, there always used
to be a group column. Now, this column has the same name as the
variable in the shape formula (“response”, “component”, etc.).New features:
shape can include multiple groups.coef_rename can be an unnamed vector of length equal to the number
of terms in the final table, obtained after coef_map and coef_omit
are applied and models are merged.coef_omit accepts numeric indices. Positive values: coefficients to
omit. Negative values: coefficients to keep.datasummary_skim: Increased maximum number of variables to 250.Bug fixes:
Breaking change:
siunitx version 3.0.25 LaTeX package.title argument now respects the escape argument for all
kableExtra output formats. This can break tables in which users
manually escaped titles.New features:
align argument for all
output formats. modelsummary(mod, align = "ld")update_modelsummary() function makes it easy to install the dev
versions of modelsummary and its dependencies (mostly useful for
Vincent and people who report bugs).haven labels in modelsummary(),
datasummary(), datasummary_skim()output = "filename.csv"output = "filename.xlsx"add_columns argument supported in modelsummary()datasummary_balance supports the stars argument.align = "d" column.Bug fixes:
shape argument accepts interactions with the colon “:” character.
This combines two columns into one, which can be useful to display
terms and group names in a single column.parallel::mclapply. See ?modelsummarymodelsummary no longer computes confidence intervals when not
necessary, which can save some time. Also see: conf_level=NULLThis first major release accompanies the publication of an article in the Journal of Statistical Software:
Arel-Bundock, Vincent (2022). “modelsummary: Data and Model Summaries in R.” Journal of Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 https://doi.org/10.18637/jss.v103.i01.’
If you like modelsummary, please cite the JSS article and tell your
friends about it.
Minor changes:
gof_map="all" includes all available statistics. gof_map="none"
excludes all statistics.diagnostic=NULL and
test=NULL by default for speed.Breaking changes:
modelsummary_wide is no longer available. Use the shape argument
of modelsummary instead.modelsummary now uses the easystats packages (performance and
parameters) to extract estimates and goodness-of-fit statistics
instead of broom. This can be reverted by setting a global option:
options(modelsummary_get="broom"). This change aims to (1) increase
consistency across models, (2) improve the developers’ ability to push
bug fixes upstream when necessary, and (3) improve support for mixed
effects, bayesian, and GAM models. The two main drawbacks are: (a) The
set of printed statistics may be slightly different from previous
versions of modelsummary (b) The group identifiers used in the
shape formula will also be different for certain models (e.g., in
nnet::multinom, y.level becomes response).New features:
shape argument accepts a formula and can reshape information in
myriad ways. Deprecates the group argument. Examples:
~ statistic: statistics are shown horizontally in distinct
columns.model ~ term: models in rows and terms in columns.term + y.level + statistic ~ model: grouped coefficients for
multivariate outcome in nnet::multinomy.level ~ model: partial match is the same as the previous formulafmt:
modelsummary(mod, fmt = list(estimate = 2, std.error = 1, rmse = 4))glue to apply functions to numeric values by setting
fmt = NULL. Example:
modelsummary(model, fmt = NULL, estimate = "{log(estimate)}")Bug fixes:
group_map rename issuelm models.datasummary_skim output to jpg should now worksescape fixesexponentiate argument for modelsummary() and modelplot()gof_map accepts a vector such as c("rmse", "nobs", "r.squared")rlang dependencydatasummary_balance:
~ 1 as a formula to summarize all data.Misc:
lmmodelsummary:
vcov strings like HC1 and Robust are now case-insensitivegof_map now accepts a data.frame or tibble with a fmt list-column
which includes functions (see Examples in docs)R2 is no longer computed by default for bayesian and mixed effects
models. An informative one-time warning is printed about the metrics
argument.datasummary_skim:
kableExtra factory:
col.names argument can now be passed to kableExtra::kbl
through the … ellipsis.Misc:
output = "github_document" is now supportedmodelsummary:
vcov argumentdatasummary_balance:
Misc:
modelsummary:
vcov argument handling for fixest models (#357 by
@grantmcdermott)fixest::i() variables and interactions (#361 by
@grantmcdermott)datasummary_correlation:
add_rows and add_columns arguments are now available here.Misc:
modelsummary_factory_default, modelsummary_factory_html, etc.intersectBug fixes:
datasummary_balance: escape variable names when escape=TRUEBreaking change:
dcolumn for dot-aligned columns is deprecated. Use “d”
in the align argument instead.Other changes:
\num{} function
from the siunitx package by default. This produces much nicer
formatting. This can be disabled with a global option. See
?modelsummaryalign argument accepts a “d” column for dot-alignment using the
siunitx LaTeX package: align="ldd".escape argument in most table-building functions.threeparttable=TRUE argument through ...tidyrmodelsummary:
group: The order of terms in the formula determines the order of
rows/columnsmodelsummary_wide:
modelplot:
datasummary_crosstab:
statistic=NULL produces a very basic crosstabdatasummary_crosstab:
modelsummary:
options("modelsummary_stars_note" = FALSE)longtable=TRUE works for LaTeX outputcoef_map
or coef_rename are used.group = model ~ term + group is now supported.datasummary_skim:
datasummary_skim("categorical") keeps NA by default. Users can
convert variables to factors before calling datasummary_skim to
exclude NA.Other:
modelsummary(model1, model2)gt titles use the new caption argument in the gt 0.3.0 functionBreaking change:
stars=TRUE have been updated to be
consistent with the default output from base R (e.g., in summary.lm).
The new significance thresholds are: “+” p < 0.1, “” p < 0.05, ””
p < 0.01, ”” p < 0.001datasummary_crosstab:
datasummary:
N is smart enough to return either the number of elements in a
subset or the number of non-missing observations in a variabledatasummary_balance:
NAs in factor variables by default. Users can convert their
variables with the factor() function to omit NAs automatically.modelsummary:
get_gof (glance) is now optional.sandwich, which allows things like:
modelsummary(model, vcov = "bootstrap", R = 1000, cluster = "firm")Other:
output="jupyter"modelsummary:
modelsummary: group and group_map for grouped
parameters (e.g., outcome levels in multinomial logit or components of
gamlss model).dvnames() makes it easy to get dependent variable column titles
(thanks to @NickCH-K)output="modelsummary_list" to save a lightweight list-based
representation of the table which can be saved and fed to
modelsummary once more to get a full table.vcov adds a row to note the type of standard errors.modelsummary accepts a single model with multiple vcovs.get_gof forwards … to model_performancecoef_map accepts unnamed vectors for easy subsettingfixest::fixest_multi supportoptions(modelsummary_get) to set the order of extraction functions
to use under the hood (broom vs. easystats vs. all)metrics argument of performance::model_performance is available
via modelsummary’s … ellipsis to limit the GOF statistics in
Bayesian models.estimate="{estimate}{stars}"gt by setting
options(modelsummary_factory_html="gt")datasummary_correlation:
... forwarddatasummary_correlation_formatdatasummary_correlation’s method argument accepts functions and
“pearspear” (thanks to @joachim-gassen)datasummary:
datasummary functions and rounding accept …, big.mark, etc.datasummary_skim:
Bug fixes and lints
tidy_custom allows partial term matchesmodelsummary(coef_rename) accepts functionscoef_rename for use in
modelsummary(coef_rename=coef_rename)modelplot accepts add_rows to add reference categoriesstatistic_override becomes vcovestimate and statisticextract is no longer documented.threeparttable, colors, and many other LaTeX optionspkgdown website and doc improvementsmitools tidiers