Releases: ddsjoberg/gtsummary
gtsummary 1.6.1
New Functionality
-
Added the standard error of proportions to the list of available statistics for categorical data summaries in
tbl_svysummary()
. (#1187) -
Added Tarone-Ware test to
add_p.tbl_survfit()
(#732) -
Updated
add_global_p()
to handletbl_uvregression()
objects where users specified thex=
argument (wheny=
argument is more common). (#1260)
Other Updates
-
Updated start-up messaging. (#1228)
-
The
paired.wilcox.test
available inadd_p.tbl_summary()
andadd_difference.tbl_summary()
was mistakenly marked as returning a difference, but it does not. The documentation has been corrected, which results in improved messaging to the user when the test is selected inadd_difference()
. (#1279) -
Improved error messages for paired tests in
add_p()
andadd_difference()
whengroup=
argument is not specified. (#1273) -
Added argument
with_gtsummary_theme(msg_ignored_elements=)
argument. Use this argument to message users if any theme elements will be overwritten and therefore ignored inside thewith_gtsummary_theme()
call. (#1266) -
Swapped
gt::fmt_missing()
forgt::sub_missing()
as the former is now deprecated. (#1257) -
The checks for
"haven_labelled"
class are now only performed for the variables indicated ininclude=
andby=
intbl_summary()
andtbl_svysummary()
. The checks intbl_uvregression()
andtbl_survfit.data.frame()
are only applied to the variables ininclude=
, e.g. no checking for the outcome variable(s). -
Updates to labels and default formatting functions of unweighted statistics presented in
tbl_svysummary()
. (#1253) -
Adding additional structural checks in
tbl_merge()
andinline_text()
to provide better error messaging. (#1248) -
Added
tbl_regression.crr()
method with messaging recommending use oftidycmprsk::crr()
instead. (#1237) -
The experimental support for
ftExtra::colformat_md()
inas_flex_table()
has been removed. The function requires evaluated YAML paths and does not allow un-evaluated references likebibliography:: "`r here::here()`"
. (#1229) -
Update for
tbl_summary(by=)
that now allows for a column named"variable"
to be passed. (#1234) -
Added theme element to control what missing statistic is shown in summary tables with options to display number or percent missing or non-missing or total number of observations. (#1224)
-
Renamed
modify_cols_merge()
tomodify_column_merge()
to be inline with the othermodify_column_*()
functions.
Bug Fixes
-
Fix in
as_kable_extra()
when output format is'latex'
where a cell that had been bold or italicized had special characters double-escaped. Added a condition not to escape special characters in these styled cells. (#1230) -
Fix in
with_gtsummary_theme()
. The function restored any previously set theme, but inadvertently included the temporary theme along with it.
gtsummary 1.6.0
Improvements to as_kable_extra()
- For users who used the default kableExtra print without output-specific formatting, there are no breaking changes...the only changes will be improved output styling.
- The biggest user-facing change is that the default results for LaTeX output are now greatly improved compared to previous releases, when
escape=FALSE
(the new default).- Markdown bold, italic, and underline syntax in the headers, spanning headers, caption, and footnote will be converted to escaped LaTeX code.
- Special LaTeX characters in the body of the table will be escaped with
.escape_latex()
or.escape_latex2()
, e.g.%
will be updated to\\%
, and rendered as%
in the PDF document. - The "\n" symbol will be recognized as a line break in the table headers, spanning headers, caption, and the table body.
\n
is removed from footnotes- The
escape=
argument is now passed tokableExtra::add_header_row()
andkableExtra::footnote()
as well (previously, was only passed toknitr::kable()
).
- The
as_kable_extra(escape=, format=)
arguments have been made explicit, where previously, these arguments were passed via...
. - Breaking Change The default value of
escape=
is nowFALSE
. If users previously usedas_kable_extra(escape=FALSE)
and had manually escaped LaTeX/HTML characters in the body of the table, these characters will now be double escaped. To print the table without the auto-escaping that is now present, utilize the new argumentas_kable_extra(addtl_fmt=FALSE)
- Breaking Change The
fmt_missing=
argument was added toas_tibble()
,as_kable()
, andas_kable_extra()
in the last release. This argument is now deprecated inas_kable()
andas_kable_extra()
. If a user does not want missing values formatted, they can exclude these commands with theinclude=
argument. - Breaking Change The
strip_md_bold=
has been deprecated. The markdown syntax will automatically be stripped from headers, unlessescape = FALSE
andformat = "latex"
. In that case, the markdown syntax will be converted to LaTeX commands. - HTML Updates
- The default markdown syntax in the headers and spanning headers is removed.
- Special characters in the table body, headers, spanning headers, caption, and footnote will be escaped with
.escape_html()
. - The
"\n"
symbol is removed from the footnotes
Improvements to as_flex_table()
- Added support for markdown syntax in {flextable} header rows by utilizing the {ftExtra} package. If this package is installed and
options(gtsummary.use_ftExtra = TRUE)
has been set (or the equivalent theme element), the bold/italic markdown syntax found in the headers will be styled. Otherwise, the markdown syntax is stripped from the header rows. (#1200)
New Functions
-
New function
as_hux_xlsx()
added to export a formatted {gtsummary} table directly to Excel. -
Added a
tbl_regression.tidycrr()
method to summarize competing risks regression models. (#1169) -
Added tidier
tidy_wald_test()
, a generic function that can calculate Wald test statistics for groups of variables in a model. The tidier expects the model object is supported by bothvcov()
andcoef()
to obtain the variance-covariance matrix and the coef vector. -
Adding functions
get_gtsummary_theme()
andwith_gtsummary_theme()
for extracting the current gtsummary theme and running code with a temporarily theme. -
Added new function
modify_column_indent()
--a wrapper formodify_table_styling()
--to make it easier to add and remove indentation in a table. -
Now exporting a function primarily used internally as a helper for converting a gtsummary table to gt (and other formats):
.table_styling_expr_to_row_number()
. -
Theme helper function
check_gtsummary_theme()
has been added. The function takes a gtsummary theme list as the input, and runs various consistency checks. Useful when constructing a personalized theme. This function replaces the internal checks that a passed theme element is indeed a valid theme element.
New Functionality
-
Functions
bold_labels()
,bold_levels()
,italicize_labels()
,italicize_levels()
are now method functions so they can work better ontbl_cross()
objects. -
Total overhaul to the way statistics are saved and reported in
modify_header()
,modify_spanning_header()
,modify_footnote()
, andmodify_caption()
. There is now a standardized place to these statistics to be saved in all gtsummary tables (inx$table_styling$header
in columns starting with"modify_stat_"
). The modify functions have been updated to access the statistics from the header data frame. An added benefit to this structure, is that the statistics are available after tables are merged and stacked. Statistics available inmodify_caption()
are taken from the"label"
column. (#1165, #1101) -
Added
add_global_p(anova_fun=)
argument allowing users to pass custom functions to calculate global p-values whencar::Anova()
does not support the model type. (#1149) -
Functions
bold_labels()
,bold_levels()
,italicize_labels()
, anditalicize_levels()
now bold/italicize the first column shown in the table. Previously, the"label"
column (which is most often the first shown column) was styled. -
Added theme element to pass arguments to
knitr::kable()
inas_kable()
andas_kable_extra()
. -
Updated the default function in
add_glance_*(glance_fun=)
for MICE models. (#1137) -
Add
tbl_butcher(keep=)
argument to optionally keep some internal objects as needed. (#1148) -
Adding Norwegian translations (#1143)
Other Updates
-
Removed use of
round()
instyle_number()
, and replaced it with a round function that does not "round-to-even". (#1140) -
Converted the Table Gallery vignette into an FAQ+Gallery (#811)
-
Added error messaging if user tries to run
add_p()
oradd_difference()
twice. (#1209) -
All models CIs were labelled as a Confidence Interval. Now Bayesian models will correctly label the Credible Interval. (#1196)
-
Improved error messaging the functions
as_gt()
,as_kable()
,as_flex_table()
,as_hux_table()
when an object that is not class 'gtsummary' is passed. (#1188) -
Deprecated the
as_huxtable(strip_md_bold=)
as {huxtable} now recognizes the markdown syntax and there is no reason to remove the markdown syntax. -
Added
huxtable::set_header_rows()
to theas_hux_table()
stack. -
Improved error messaging in
modify_*()
functions. (#914) -
Added
style_percent()
as the default formatting function for un-weighted proportions. (#1181) -
The global options previously available have now been soft deprecated. All documentation of the global options was removed in v1.3.1. (#1085)
-
The
as_flextable()
function has been upgraded from a soft to a hard deprecation; useas_flex_table()
instead. -
No longer removing the survey design columns from survey objects from the columns that will be summarized in
tbl_svysummary()
and those summarized intbl_uvregression()
. If users previously didn't indicate which variables to summarize withinclude=
, then the design columns will now appear in the summary tables. (#1166) -
Added a check for functions that accept
...
where nothing should be passed in the...
. If a bad or misspelled argument is found, the users are informed. (#1083)
Bug Fixes
-
Fix in
"emmeans"
methods foradd_difference()
to due an argument name change in the emmeans package. We now require the most recent version of the package. (#1205) -
Bug fix in
inline_text.tbl_summary()
where one could not pass a pattern only when the column argument wasNULL
. (#1193) -
Fix in
as_gt()
when there are no hidden columns. -
Fix in
add_p.tbl_svysummary()
when Wald tests were converted to flextable. The survey tidier saved the column as a matrix-column instead of a vector, which was incompatible with flextable output. (#1153) -
Fixing Lancet theme mid-point encoding issue on Linux and MacOS. (#1146)
-
Fix when using summary type gtsummary selectors (e.g.
all_continuous()
) with theadd_ci(style_fun=)
argument. (#1141)
gtsummary 1.5.2
-
Removed foreign reference to external functions in the top level of the package and replaced with indirect calls (the reason for the short time between releases). (#1129)
-
Updates to the way footnotes are printed in
tbl_summary()
when there is summary type"continuous2"
present. Previously, all footnotes were removed, and now only the"continuous2"
footnotes are removed. (#1127) -
Added the continuous variable name/label to the footnote for greater clarity in
tbl_continuous()
(#1123) -
Now exporting the
.create_gtsummary_object()
function as a utility for other packages to build gtsummary tables. (#1130) -
Fix when
add_overall()
was run beforeadd_n()
. The overall row was not being omitted from the sum and the Ns were doubled. (#1126) -
Added method "emmeans" to
add_difference()
fortbl_svysummary()
objects. -
Updated default
add_difference()
fortbl_svysummary()
objects to be "emmeans" for continuous and dichotomous variables, and "smd" for categorical variables.
gtsummary 1.5.1
New Functions
-
Added new function
modify_column_alignment()
to updated column alignment. Function is a wrapper for the more complexmodify_table_styling()
function. -
New function
tbl_strata2()
that passes both the the stratified data frame as well as the stratum level to the user function. (#1091) -
Added a
add_p.tbl_continuous()
method for adding p-values totbl_continuous()
tables. (#1023) -
Added
add_overall.tbl_continuous()
method. (#1037)
New Functionality
-
New test option "emmeans" in
add_difference()
andadd_p()
uses the {emmeans} package to estimate marginal means/least-squares means for continuous variables, binary variables and random intercept models. (#1112) -
Column alignment is now recognized in
as_kable()
andas_kable_extra()
. Previously, the alignment utilized thekable()
defaults and ignored any alignment instructions included in the gtsummary table styling. -
The
as_kable_extra()
was updated to utilizekableExtra::column_spec()
andkableExtra::cell_spec()
to apply bold and italic styling. The choice of the function depends on the use ofescape=
inknitr::kable()
(#1107) -
Default arguments to
knitr::kable()
may now be overwritten by passing...
to eitheras_kable()
oras_kable_extra()
. Previously, passing a user-defined argument previously in use would result in error. -
Added
tbl_strata(.header=)
argument providing greater control over the stratum headers that are added to the tables, e.g. you can now add Ns to the headers using this argument. -
Added
add_p.tbl_cross(test.args=)
argument. (#1095) -
The
tbl_strata(.combine_args=)
has been added that lets you control all arguments in thetbl_merge()
ortbl_stack()
that occurs intbl_strata()
. (#1090) -
Added the
add_ci(pattern=)
argument, which makes it easier to merge the CI column with the primary statistics column. (#1029) -
Suppress
tbl_merge()
spanning headers by passingtbl_merge(tab_spanner = FALSE)
(#1067) -
Functions
as_tibble()
,as_kable()
, andas_kable_extra()
gain thefmt_missing=
argument that applies missing symbols to missing values. Theas_tibble()
argument defaults toFALSE
, while the others' default isTRUE
. (#1073) -
Adding
tbl_regression(conf.int=)
andtbl_uvregression(conf.int=)
argument. For some models, the confidence interval adds to the computation time significantly and may not be needed. This argument will omit the CI calculation. (#1052) -
The
add_stat()
function was updated to accepttbl_continuous()
tables. -
Multinomial models computed using MICE are now supported. (#1065)
-
Added theme element to control the
tbl_regression(conf.int=)
default argument. -
It is now possible to pass a single tbl to
tbl_merge()
. This is useful when usingtbl_merge()
as a helper in other functions. (#1068) -
Added
statistics=
anddigits=
arguments to theadd_overall()
family of functions. (#1047) -
Added
digits=
argument totbl_cross()
. (#1046)
Other Updates
-
Allowed modification to font_size for compact theme. (#1106)
-
Automatically reduced vertical white space between columns for compact flextable theme.
-
Improved user interface for
modify_*()
functions (#1064) -
Improved error messaging throughout the package. (#1050)
-
Added link to the
syntax
help file to functions throughout the package. Thesyntax
help file illustrates how to use the gtsummary selectors and details the formula-list notation. (#981) -
Updated Spanish translation for Wilcoxon Rank-sum Test.
-
Updates and additions to Portuguese language translations. (#1098)
-
Updates to the French translations.
-
Updating the
add_overall()
S3 method to have a more common structure, e.g.add_overall(x, ....)
, where previously, the...
were not present. (#1066) -
Updated the
theme_gtsummary_journal("qjecon")
to settbl_regression(conf.int = FALSE)
by default. -
Improved error messaging in
tbl_custom_summary()
-
Updated the default formatting functions in
tbl_custom_summary()
. Previously, summaries with character results erred because the default summary function wasstyle_number()
. This has been updated tostyle_sigfig()
for numeric columns, andas.character()
for everything else. (#983) -
All
style_*()
functions will retain attribute, such as the names. (#1035, #1031, #981) -
The
add_n.tbl_regression()
(which is also utilized intbl_uvregression()
) was adding the N column without applying a formatting function. Thestyle_number()
function has now been added as the default styler. (#1022) -
Added class
"tbl_continuous"
to the output oftbl_continuous()
. -
Adding
add_p()
test"mcnemar.test.wide"
to calculate the p-value when the data are stored in a wide format, e.g. one column for a before value and a second column for after. The other McNemar test variant available in {gtsummary} expects data in a long format. -
Converted
tbl_split()
to S3 function. -
Update how calls to
gt::fmt_missing()
are constructed to be more memory efficient.
Bug Fixes
-
Fix in
add_significance_stars()
that led to an error when the summarized model did not have a confidence interval column. -
Fix in
as_flex_table()
andas_hux_table()
where reference row was not properly placed after atbl_merge()
when the merged tables share common categorical variables but different reference rows. (#1063) -
Fix in
inline_text.gtsummary()
where the first level of a categorical variable could not be selected if the table had also been processed withremove_row_type()
. (#1078) -
Fix in
modify_table_styling(cols_merge_pattern)
when it is used withtbl_stack()
followed bytbl_merge()
. (#1057) -
Bug fix in
separate_p_footnotes()
where test names were not being translated whentheme_gtsummary_language()
was set. (#1055) -
Fix in
tbl_merge()
when rows in a merging table are not present in the first table. (#1033) -
Fix in
as_tibble()
fornnet::multinom()
regression models. -
Fix in
tbl_continuous()
wheninclude=
is not specified. -
Fix in
tbl_regression()
when a tidier returns CI columns that are all missing. (#1012) -
Fix in
add_p()
/add_difference()
when check whether the passed test is an internal method or a custom method. The previous code required Suggested packages, such as, {lme4}, {effectsize}, and {survey}, to be installed. (#1018)
Breaking Changes
- No longer exporting
assert_package()
. It has been migrated to {broom.helpers} and we now usebroom.helpers::.assert_package()
. (#1051)
gtsummary 1.5.0
New Functions
-
Added new function
tbl_continuous()
to summarize a continuous variable by 1 or more categorical variables. -
Added new function
add_ci()
that adds a new column with the confidence interval for proportions/means reported intbl_summary()
. (#868) -
Migrated a new function
tbl_split()
from the {bstfun} package. Function allows users to split a {gtsummary} table into multiple tables. -
Migrated a new function
separate_p_footnotes()
from the {bstfun} package. Function allows users to separate the composite footnote listing the tests performed inadd_p()
, and replaces it with individual footnotes for each test name. -
New function
tbl_custom_summary()
allowing to create a table of summary statistics using a custom summary function (#973, #976)- Set of helpers to be used with
tbl_custom_summary()
:continuous_summary()
,proportion_summary()
,ratio_summary()
- Set of helpers to be used with
-
New function
modify_cols_merge()
that can merge two or more columns in a {gtsummary} table. (#939) -
Added function
tbl_butcher()
to reduce the size of a {gtsummary} table. After an object has been butchered, other {gtsummary} functions may not be able to execute on the object. -
Added new function
tidy_robust()
that will add robust standard errors, confidence intervals, and p-values withtbl_regression()
andtbl_uvregression()
. The function is a wrapper forparameters::model_paramters()
. (#979)
New Functionality
-
Added a
CITATION
file so users can now cite the R Journal manuscript usingcitation("gtsummary")
. -
Added Standardized Mean Difference method to
add_difference()
, wrapping the {smd} package's calculations. (#966) -
Extended
add_difference()
to accepttbl_svysummary()
objects in addition totbl_summary()
objects. -
Added a standardized mean difference method for
tbl_svysummary()
tables. -
Added
tbl_strata(.stack_group_header=)
argument to include/exclude the headers when tables are combined withtbl_stack()
-
Added
tbl_strata(.quiet=)
argument. -
Allow
add_p()
andadd_difference()
to be run on the same table. (#959) -
Updated
add_overall()
to include the overall statistics in thedf_stats
tibbles saved in.$meta_data.
This makes it possible to report any of the overall statistics using theinline_text(pattern=)
argument.
Other Updates
-
Added a help file detailing the formula list notation used throughout the {gtsummary} package. (#981)
-
Updates to
tbl_regression()
documentation. The model N is no longer reported by default, and removed that section from the help file. (#998) -
Updates to make the internal
df_stats
objects consistent across various {gtsummary} objects. Added internal functiondf_stats_to_table_body
that adds the numeric df_stats tibble to.$table_body
. The formatting functions are also added for the new columns to.$table_styling$fmt_fun
. This function is now used ininline_text.gtsummary()
to prepare the returned statistics (#921) -
Now using
broom::tidy()
to prepare thecar::Anova()
results. This will be more stable than the version originally written. (#898) -
The function
assert_package()
now takes the minimum required version of the package from the DESCRIPTION file, and the function is now exported. -
Now using
broom::tidy()
to prepareaov()
test results inadd_p.tbl_summary()
, which adds additional columns to.$table_body()
(#956) -
Updated the
README
to include links to a recording of a gtsummary presentation and to the RStudio Education blog post. -
Removed
maturing
lifecycle tag fromREADME
. -
Updated deprecated function
workflows::pull_workflow_fit(x)
toworkflows::extract_fit_parsnip(x)
.
Bug Fixes
-
Fix in
tbl_summary()
when a factor variable is passed that is allNA
with no specified levels. (#977) -
Fix in
add_p.tbl_summary()
when a factor variable with all NA values is passed. (#977) -
Bug fix for the
add_difference(estimate_fun=)
argument.
Breaking Changes
-
Updated
add_p.tbl_summary(test = . ~ "mcnemar.test", group = id)
syntax to require thegroup=
argument to align with the paired Wilcoxon rank-sum test and paired t-test syntax. -
Deleted deprecated functions
add_comparison()
,add_global()
,tab_style_bold_p()
,tab_style_bold_labels()
,tab_style_italicize_levels()
,tab_style_italicize_labels()
,tab_style_bold_levels()
. -
The following deprecated arguments have been removed:
tbl_summary(group=)
,as_gt(omit=)
. -
The survival package has been moved from Imports to Suggests, and will no longer automatically be installed when {gtsummary} is installed. Additionally,
survival::Surv()
is no longer re-exported with the package.
gtsummary 1.4.2
-
Update to the internals of
tbl_stack()
to better handle when two or more stacked tables are then stacked again (#906) -
Updates to make
tbl_svysummary()
compatible with {survey} package updates in v4.1 (#930) -
The
as_hux_table()
function previously stripped markdown old syntax from column headers and spanning headers. The output now uses markdown syntax in the headers by default utilizinghuxtable::set_markdown()
(#885) -
Variables passed in the
tbl_svysummary(by=)
argument will now automatically be added toinclude=
. (#925) -
Bold and italic requests are now ignored for kableExtra output. These are carried out via markdown syntax, which is not supported by {kableExtra} (#917)
-
Bug fix for
add_p.tbl_cross(pvalue_fun=)
; argument was being ignored. -
Updated
style_pvalue()
to format p-values slightly larger than 1 and slightly lower than 0 (due to imprecise numeric storage). (#907) -
Fix allowing for factor vectors to be passed in
tbl_stack(group_header=)
. (#908) -
Updated arguments
y=
andx=
intbl_uvregression()
to allow for non-standard names (#912)
gtsummary 1.4.1
-
Updated
tbl_regression()
to be compatible with models created with the {parsnip} and {workflows} packages (#890, #647) -
Added the
modify_table_styling(text_format = "indent2")
option to double indent a row. (#864) -
Messaging update when
inline_text.gtsummary()
suspects a variable has been repeated in the gtsummary table. (#855) -
Bug fix in
add_p.tbl_summary()
for columns that are allNA
. These variables no longer error; rather, a message is printed indicating the p-value is not possible to calculate. (#889) -
Updated
tbl_svysummary()
to be compatible with {srvyr} package (#886) -
Updated default header when using
tbl_uvregression(x=)
to"**Outcome**"
(#867) -
The
tbl_summary(by=)
variable is now added toinclude=
by default (#871) -
Variables are converted to numeric before being passed to
wilcox.test()
inadd_p()
. This avoids an error when a date difference is passed. (#880) -
Bug fix for {Hmisc} labeled data with
tbl_summary()
(#876) -
Bug fix in
add_n.tbl_summary()
to proportion missing in some cases. (#903) -
Updates to the default formatting functions in the
add_glance_*()
functions. P-values are now styled withstyle_pvalue()
and No. Obs. and degrees of freedom withstyle_number()
(#870)
gtsummary 1.4.0
New Functions
-
Added new function
add_glance_table()
as a companion toadd_glance_source_note()
. Function adds model statistics, such as R-squared, to the bottom of the model summary table. -
Added new function
add_significance_stars()
adding star indicators to significant estimates and an explanatory footnote. -
Added new function
tbl_strata()
. The function aids prepares gtsummary tables stratified by one or more variables (#679) -
Adding coefficient
plot()
methods fortbl_regression()
andtbl_uvregression()
. Function creates a forest plot of model coefficients viaGGally::ggcoef_plot()
. -
New function
modify_fmt_fun()
has been introduced to help update the functions that format numeric columns and rows in.x$table_body
. -
New function introduced,
modify_table_styling()
, to update printing instructions of tables. This function replacesmodify_table_header()
, which is now soft deprecated. -
Added function
add_vif()
to include variance inflation factors intbl_regression()
output. (#717) -
Added a generic function
inline_text.gtsummary()
that can report results from any gtsummary table. (#398)
New Functionality
-
Print infrastructure has been updated to allow for both row and column specification when formatting data or table styling. The
x$table_header
object has been replaced with a more generalx$table_styling
. Review the updated vignette"gtsummary_definition.Rmd"
for details. Thex$table_body
is no longer grouped aftertbl_stack()
; rather, the grouping variable is specified ingt::gt(groupname_col=)
-
tbl_summary()
now accepts any class as input. Previously only non-date base classes were accepted. For non-base R classes, the summary type must be specified usingtbl_summary(type=)
. The default summary statistic for dates/times is the minimum and maximum. (#488) -
The
add_stat()
function may now return multiple columns of new statistics. Some arguments have been deprecated in the update. (#746) -
tbl_uvregression()
now accepts both data frames and survey design objects as input. (#742) -
If the default
tidy_fun = broom::tidy
fails,parameters::model_parameters()
attempts to tidy the model, if {parameters} is installed. (#854) -
Added a custom tidier for
mgcv::gam()
models (tidy_gam()
) and a method function (tbl_regression.gam()
) that uses the new tidier by default. (#745) -
Added default support for
brmsfit
model intbl_regression()
with new method function. (#751) -
Functions
modify_footnote()
andmodify_spanning_header()
now include thetext_interpret=
argument indicating whether to usegt::md()
orgt::html()
to format text. Default isgt::md()
. -
Added/updated functions
add_n()
andadd_nevent()
to work withtbl_regression
andtbl_uvregression
objects. Each function now has an argument to place Ns on the label or level rows. (#744) -
Added The Quarterly Journal of Economics to
theme_gtsummary_journal()
. This journal theme will be updated again after the gt package updatescols_merge()
with a rows argument and allows for line breaks within cell. -
Korean and Icelandic language translations added for
theme_gtsummary_language()
. -
Ability to merge two or more columns with
modify_table_styling(cols_merge_pattern=)
argument. -
Added theme element
"pkgwide-fun:pre_conversion"
. The function specified here will be executed on the gtsummary object before it is printed or converted with theas_gt()
,as_flex_table()
, etc functions. (#773) -
The
modify_table_body(fun=)
argument has been generalized to accept formula shortcut notation. -
Added exploratory data analysis theme that shows more details by default,
theme_gtsummary_eda()
.
Other Updates
-
Updated
tbl_merge()
andtbl_stack()
to capture the first source note and caption in the merged/stacked tables. Previously, any captions and source notes were lost. -
Added messaging when table caption requested via
modify_caption()
for a gt table when using a version of gt that does not support captions. -
Updates to the table gallery vignette reflecting changes in the package. (#775)
-
Improved error messaging when there is a problem constructing one of the univariate regression models in
tbl_uvregression()
. -
Added variable-specific formatting to
add_difference(estimate_fun=)
allowing a single table to show, for example, mean and rate differences that are formatted/rounded differently. -
Improved handling and messaging to users when columns with
"haven_labelled"
class are passed to gtsummary functions. (#805) -
Improved handling of ordered factors as the
by=
variable (#569, #540) -
Removed {usethis} package dependency and replaced with {cli}. (#768)
-
Added the survey-adapted t-test to
theme_gtsummary_mean_sd()
for continuous variables inadd_p.tbl_svysummary()
(#758) -
Allowing for tidyverse shortcut notation in
tbl_survfit(estimate_fun=)
specification, e.g.tbl_survfit(estimate_fun= ~style_sigfig(.x * 100))
(#761) -
The JAMA journal theme has been updated to merge the coefficient and confidence interval columns.
-
Updated other
inline_text()
functions to wrapinline_text.gtsummary()
Bug Fixes
-
The
label=
argument for unstratified models was being ignored intbl_survfit()
(#842) -
Preserve ordering for factor variables in
tbl_survfit()
. (#764) -
Bug fix for spanning headers with kableExtra output. The spanning header was misplaced when the header text was sandwiched between two blank spanning headers.
-
Bug fix when displaying an unobserved level of a factor variable dichotomously in
tbl_summary()
. (#780) -
Bug fix in
add_p()
where test name footnote was not being translated withtheme_gtsummary_language()
.
Breaking Changes
-
tbl_survival()
has moved from questioning to deprecated. This function maintains the oldx$table_header
format (instead of the more flexiblex$table_styling
). The"level_label"
column was renamed to"groupname_col"
and thex$table_body
is no longer grouped withgroup_by(level_label)
-
The back-end implementation of
add_stat_label(location = "row")
has been updated. The function now merges columns"label"
and"stat_label"
instead of modifying the"label"
column directly. This could be a breaking change if users had manually updated results, for example, from atbl_regression()
table to merge withtbl_summary()
usingtbl_merge()
-
The function
add_stat_label()
no longer auto-switcheslocation = "column"
requests to"row"
in the presence of"continuous2"
variables.
gtsummary 1.3.7
- No changes. Resubmitting to resolve CRAN quirk.
gtsummary 1.3.6
New Functions
-
Added function
add_difference()
, which adds difference between groups, confidence interval and p-value. (#617) -
Added function
modify_caption()
that includes table captions. For gt output, requires gt version > 0.2.2 (#701) -
Added function
modify_table_body()
allowing users to more easily make changes to gtsummary tables -
Added function
remove_row_type()
for removing header, reference, or missing rows from a gtsummary tables. (#678) -
Added selecting function
all_stat_cols()
that selects columns fromtbl_summary
/tbl_svysummary
object with summary statistics (i.e."stat_0"
,"stat_1"
,"stat_2"
, etc.). -
New selecting function was added
all_tests()
to make it easier to select variables based on the test used to calculate the p-value, e.g.add_p(test = c(age, marker) ~ "t.test", test.args = all_tests("t.test") ~ list(var.equal = TRUE))
-
Added functions
modify_column_hide()
andmodify_column_unhide()
to hide and unhide columns in.$table_body
. Simple wrappers formodify_table_header()
.
New Functionality
-
Previously, the
tbl_summary(digits=)
only accepted integer values specifying the number of decimal places to round a statistic. The argument now accepts both integers or functions, e.g.digits = age ~ style_sigfig
. (#708) -
The
add_stat()
function now supportstbl_svysummary()
objects in addition totbl_summary()
(#688) -
The
add_stat()
function can now place statistics on the label row, or the level rows for categorical variables. (#714) -
inline_text.tbl_survfit()
updated to allow users to select p-value (and other) columns. (#589)
Other Updates
-
modify_header()
has been updated so users may more easily access internal data while defining headers and so that it no longer adds its call to the gtsummary.$call_list
(#719) -
The default value for
include=
argument for theadd_global_p.tbl_regression()
andadd_global_p.tbl_uvregression()
methods have been made the same withinclude = everything()
, and the help files for these methods have been brought together in a single file. (#721) -
Introducing new package dependency {broom.helpers}
-
The tidying and preparation of
tbl_regression()
tables are now being performed by {broom.helpers} (#636, #607) -
All select helper functions and the utility functions that make them possible, have been cleaned up and migrated to {broom.helpers}. (#648, #680)
-
Importing
.generic_selector()
,.select_to_varnames()
, and.formula_list_to_named_list()
from {broom.helpers}: this is a function that makes it easy to create selecting functions likeall_continuous()
. The internals allow for it to be used in {broom.helpers} and {gtsummary} seamlessly. (#680) -
Theme element has been added for controlling the other
tidy_plus_plus()
arguments. (#692) -
Variables that do not follow standard naming conventions are now parsed correctly and presented in the regression tables.
-
-
The
tbl_regression()
function is now an S3 method. The new interface allows for special handling of different model types using S3 methods:tbl_regression.default()
,tbl_regression.lmer()
,tbl_regression.glmer()
,tbl_regression.survreg()
-
tbl_regression(add_estimate_to_reference_rows=)
argument has been added. Also added totbl_uvregression()
. (#692) -
Theme element for
tbl_regression(add_estimate_to_reference_rows=)
has been added. (#677) -
Removed
"Statistics presented:"
and"Statistical tests performed:"
prefixes from thetbl_summary() %>% add_p()
footnotes. -
The codebase powering
add_p()
and related methods has been refactored for better performance, organization, and customizability. (#622)-
For clarity, a help file listing each test available within gtsummary and the pseudo code for calculating the p-value has been added (see
?tests
) -
Each
add_p()
method now has thetest.args=
argument. Use this argument to pass additional arguments to the statistical method, e.g.add_p(test = c(age, marker) ~ "t.test", test.args = c(age, marker) ~ list(var.equal = TRUE))
-
Additional tests have been added: paired t-test, signed rank test, and more. See
?tests
for full list. -
More robust unit testing implemented for all
add_p()
methods.
-
-
Added messaging to
tbl_stack()
to inform users that the attributes from the first table passed take precedent over the others'. (#699) -
In the
modfiy_*()
functions, if users did not select any columns, they encountered an error. Now, if no columns are selected, instructions are printed for how to correctly select columns in a gtsummary table. Moreover, if no columns are selected, the gtsummary object is now returned unaltered. (#699) -
The
add_glance_source_note()
function has been generalized so users may pass any glance function. Previously,broom::glance()
was being used with no option to change it. (#699) -
The
...
arguments have been added toas_gt()
. These dots are subsequently passed togt::gt(...)
. (#701) -
Multiple imputation models created with {mice}, and multinomial regression models created with {nnet} are now supported in
tbl_regression()
(#645) -
Updates to
add_global_p.tbl_regression()
allowing for variable names with spaces and special characters (#682) -
Added
digits=
argument tostyle_percent()
(#690) -
Users may now choose which
tbl_regression()
columns to report with a theme element. they can choose among the"estimate"
,"std.error"
,"statistic"
,"ci"
,"conf.low"
,"conf.high"
and"p.value"
(#637) -
Allow users to include the reference value in
tbl_regression()
via a theme element -
Users may change the symbol with a reference row symbol with a theme element. (#628)
Bug Fixes
-
Bug fix when a default statistic is set using themes for
"continuous2"
variables that has length larger than one -
Bug fix when missing/non-missing percentages requested in
add_n.tbl_summary()
Breaking Changes
-
The default test for 2-by-2 tables with expected cell counts has been updated from the chi-squared test with continuity correction to the original chi-squared test for
add_p.tbl_summary()
(#721) -
Experimental function
add_p.tbl_survfit(test.args=)
in addition to accepting the formula list notation, also accepted a single string naming a test that was interpreted aseverything() ~ "test_name"
. The single string is no longer accepted, and users must use the formula notation. -
Removed theme element
N_fun
that was previously marked as questioning and likely to be removed from the package.