Releases: ddsjoberg/gtsummary
gtsummary 2.4.0
New Features and Functions
-
Greatly improved messaging when column headers differ in
tbl_stack()
. (#2266) -
Added the
tbl_split_by_rows(variable_level)
argument to split a table by the levels of a column inx$table_body
. -
The
tbl_stack(tbl_id_lbls)
argument has been added. When specified, a new column is added to the resulting.$table_body
labeling the rows associated with each table ID. This argument is utilized intbl_strata()
and all returned tables include a hidden column with the stratum levels. (#2288) -
Refactored
sort_hierarchical()
to allow for different sorting methods at each hierarchy variable level. -
Updated
sort_hierarchical()
andfilter_hierarchical()
to always keep attribute and total N rows at the bottom of the ARD. -
Added parameters
var
andquiet
tofilter_hierarchical()
to allow for filtering by specific hierarchy variables and to silence messages, respectively.
Other Updates
-
No longer calculating
deff
by default intbl_svysummary(type='categorical')
. -
Improved the print method for class
'tbl_split'
to be more informative. -
Added a
dim()
S3 method for'gtsummary'
class, which also allows fornrow()
calls on gtsummary objects. -
The {cardx} package is now a strong dependency. (#2256)
-
Added a method for class
"tbl_ard_hierarchical"
tosort_hierarchical()
andfilter_hierarchical()
.
Bug Fixes
- Bug fix in
add_p.tbl_cross()
when custom p-value methods were created without any additional arguments. The test and test label would revert to the default, and this is resolved.
gtsummary 2.3.0
New Features and Functions
-
Added
tbl_split_by_rows()
andtbl_split_by_columns()
to split tables horizontally (row-wise) and vertically (column-wise). (#2216) -
Users are now allows to specify/override the denominator by passing an integer or a data frame to the
tbl_summary(percent)
argument. (#2239) -
Added the
tbl_merge(tbl_ids)
andtbl_stack(tbl_ids)
arguments that allows used to label the gtsummary input tables. This is particularly helpful when callinggather_ard()
, which will return a named list of ARDs where the names are the assigned tbl IDs. (#2224) -
Adding new function
add_difference_row()
. The function is similar toadd_difference()
, except that differences are placed on the rows below the summary statistics. (#2138) -
The
style_*()
andlabel_style_*()
functions have gained thena
argument allowing users to specify howNA
values are returned. -
The
tbl_stack(attr_order)
argument has been added that allows users to specify the order in which the individual attributes take precedent when they are stacked. For example, to use the headers from the second table, specifyattr_order=2
. (#2202) -
The
tbl_regression()
function now takes advantage of a new feature in {broom.helpers} to support multicomponent models, such as, multinomial models and mixed-effects models. Reviewbroom.helpers::tidy_group_by()
for details. (#1540)
Other Updates
-
Added an article on
modify_*()
functions. (#2209) -
Added theme elements
tbl_hierarchical_count-fn:addnl-fn-to-run
andtbl_hierarchical_count-fn:addnl-fn-to-run
. (#2262) -
Added the
"add_overall.tbl_summary-arg:col_label"
theme element to control the default value ofadd_overall.tbl_summary(col_label)
. (#2246) -
Variable labels are now retained with
tbl_summary(sort=~'frequency')
. (#2260) -
Functions
sort_hierarchical()
andfilter_hierarchical()
are now S3 generics. -
The
add_overall()
function no longer returns an error when an unstratified table is passed. Rather, a message is printed and the unaltered table is returned.
Lifecycle Updates
- Updated the function name of
modify_column_indent()
to the more accurately namedmodify_indent()
as the function operates on cells rather than columns.
Bug Fixes
-
Fix in
tbl_svysummary()
when there are missing values in theby
column. -
Fixed bug in
tbl_hierarchical()
causing the overall row label to be incorrectly used as a variable label. -
Fixed bug in
sort_hierarchical()
causing some rows to be dropped when sorting unstratified tables. (#2237) -
Fixed bug in
filter_hierarchical()
causing an error for unstratified tables. -
Fix in
gather_ard()
fortbl_regression()
andtbl_uvregression()
. Previously, only the ARD for the primary regression model(s) would be returned, and now all ARDs are returned including those from subsequent calls toadd_*()
functions. (#2208) -
Fix in
tbl_merge(merge_vars)
argument when a table contained a"row_type"
column and the tables were not merged by this variable (which is included in the default). (#2205) -
Fix in
add_overall()
where not all table styling were copied from the overall table to the newly merged table. This did not affect any native gtsummary tables, but did appear in an extension package. -
Fix in experimental function
modify_post_fmt_fun()
when tables including this call, did not specify therows
argument, and were later stacked. Theenquo
environment associated with therows
argument was empty when the argument is not specified, and the empty environment caused an issue with evaluation if the table was later stacked. -
Fix in
tbl_svysummary(missing='ifany')
when the weighted number of missing observations was <= 0.5. Previously, these counts were coerced to integer and rounded to zero, and therefore, did not appear in the table. (#2229) -
Fix in
gather_ard()
fortbl_strata_nested_stack()
tables, where the function returned an empty list. (#2223)
gtsummary 2.2.0
New Features and Functions
-
Added function
modify_post_fmt_fun()
to perform formatting on cells after the primary formatting function has been applied. The functionality is similar togt::text_transform()
. (#2014) -
Data pre-processing has now been re-introduced for calculations in
add_p()
andadd_difference()
. Data pre-processing steps were removed in the v2.0 release; however, in some cases---particularlyadd_difference()
for dichotomous variables---the reduced functionality was affecting the user experience. See?tests
for details on data pre-processing. (#2165) -
The
add_variable_group_header()
function has been generalized to work with any gtsummary table, where previously only'tbl_summary'
were accepted. (#2197) -
The footnote placed on the p-value column by
add_significance_stars()
no longer replaces any existing footnote. Rather the footnote is added to any existing footnote. (#2184) -
The
remove_*()
family of functions default argument values have been updated to remove all footnotes, source notes, abbreviations, column merging, bold and italic styling by default, so the users are not longer required to remove, for example, one source note at a time. The one exception isremove_spanning_headers()
, which will remove the first level spanning headers be default. (#2161) -
Added a new theme element
tbl_svysummary-arg:missing_stat
-
Added functions
sort_hierarchical()
andfilter_hierarchical()
to sort and filter hierarchical tables. (#2096)
Bug Fixes
-
Fixed a bug in
tbl_hierarchical()
where thegroup*
variables of the resultingtable_body
were not fully populated. (#2192) -
Corrected bug causing an error in
tbl_hierarchical()
when more than oneby
variable level had been filtered out of the data. (#2173) -
Corrected the class of objects returned from
tbl_strata_nested_stack()
. -
Corrected bug in
tbl_strata_nested_stack()
when the strata variable had a single level. Previously, the indentation of the single strata level was not correct. -
Fix in
tbl_strata_nested_stack()
when there are unobserved combinations of strata levels. (#2179) -
Fixed bug in
tbl_cross()
when a column was named'missing'
. (#2182) -
Fix in theme element
tbl_summary-arg:missing_stat
that was not being applied. (#2176) -
Corrected bug in
tbl_likert()
where variables in table always appeared in alphabetical order. (#2195) -
Corrected bug in
add_n.tbl_likert()
where the Ns were not formatted withstyle_number()
. (#2195)
gtsummary 2.1.0
New Features and Functions
-
Added function
tbl_strata_nested_stack()
. The function is similar totbl_strata()
, but this function nests the resulting tables, indented under each of the strata headers. (#2006) -
The
add_ci.tbl_summary()
function now works with categorical variables that were summarized usingtbl_summary(percent = c('row', 'cell'))
. (#1929) -
Adding the
tbl_merge(merge_vars)
argument. This argument allows users to specify any merging columns providing much more flexibility when merging unlike tables. Additionally, columns selected bycards::all_ard_groups()
have been added to the default merging columns, which provides the functionality for merging the results fromtbl_hierarchical()
andtbl_hierarchical_count()
. (#1861)This does, however, introduce one change in behavior from the previous version of
tbl_merge()
. Previously, merging on a table with the same variable, but with a different label would be reconciled silently in the background and the first label would be used in the final table. While this may have been useful in a few edge cases, it largely was an unintuitive result. This update performs more straightforward merging and the results are more aligned with users' expectations. -
Added
add_variable_group_header()
function that adds a header row above a group of variables. (#2150)
Updates to modify_*()
Functions
There were a number of updates to the family of modify_*()
functions: functions that modify table attributes like headers, footnotes, bold, titles, etc.
-
Adding functions
modify_bold()
,modify_italic()
,remove_bold()
, andremove_italic()
for adding or remove bold or italic styling to cells in the table. (#2125) -
Updates to the handling of footnotes. Previously, header footnotes were handled with
modify_footnote()
andmodify_table_styling(footnote)
. It was possible to also include footnotes in the table body withmodify_table_styling(footnote)
, but this was largely a hidden feature. Also confusingly, a special abbreviation footnote was handled withmodify_footnote(abbreviation=TRUE)
.In this update, we now export separate user-facing functions for each of these with clearer names and scope:
modify_footnote_header()
,modify_footnote_body()
, andmodify_abbreviation()
. As the names indicate, themodify_footnote_header()
andmodify_footnote_body()
functions place footnotes in the header and table body. Abbreviations are now treated like source notes and do not have footnote markers associated with them. We also export functionsremove_footnote_header()
,remove_footnote_body()
, andremove_abbreviation()
to remove previously assigned footnotes and abbreviations.Also, multiple footnotes may now reference the same cell in the table or column header by utilizing the
modify_footnote_header(replace=FALSE)
,modify_footnote_body(replace=FALSE)
argument. -
Previously, source notes were an undocumented feature and only a single source note could be included in a table. We now export
modify_source_note()
andremove_source_note()
to add and remove any number of source notes. Also, when merging and stacking tables, previously due to the one source note limit, only the first source note was retained. Now all source notes will be included below the resulting table. This is different behavior compared to previous versions of the package and in rare cases may result in a different source note. Moreover,kableExtra
output now supports source notes, where previously they were omitted. -
The
modify_spanning_header(level)
argument has been added to allow for multiple levels of spanning headers in the resulting tables. Theremove_spanning_header()
function has also been added to ease the removal of spanning headers. (#2099) -
The
modify_footnote_spanning_header()
function has been added to ease adding footnotes to spanning headers. A companion function,remove_footnote_spanning_header()
, has been added to remove spanning headers. -
Added new function
modify_missing_symbol()
to update how a missing value is displayed in a table. (#2121) -
Added new function
remove_column_merge()
to undo a column merge. (#2130) -
The
modify_caption(caption)
argument now accepts a vector of captions, instead of just a string. Note, however, that not all print engines support a vector of captions. (#2107) -
Added
show_header_names(show_hidden)
argument, which will print both hidden and printed column information. (#2147)
Other Updates
- Language translations have been updated with a handful of missing translations. (#2100)
Bug Fixes
-
Swapped out
dplyr::rows_update()
with a base R implementation intbl_merge()
that allows for tables with mixed types inx$table_styling$header$modify_*
columns. For example,tbl_summary()
has integer Ns andtbl_svysummary()
has double Ns that can now be combined. (#1626) -
Corrected the
?tests
documentation file to reflect that, as of v2.0, we no longer perform pre-processing (such as, converting a column to a factor) on variables before computing tests. (#2135) -
When
add_ci.tbl_summary()
was for a variable that was allNA
we no longer return an error. Users will now see the confidence interval as'NA%, NA%'
. (#2139)
gtsummary 2.0.4
New Features and Functions
-
Added S3 methods
add_overall.tbl_hierarchical()
andadd_overall.tbl_hierarchical_count()
. -
Added the
tidy_wald_test(vcov)
argument to allow for the calculation of p-values via alternative variance-covariance structure (e.g. for robust SEs). (#2076; @aghaynes)
Other Updates
-
The
with_gtsummary_theme()
has been updated to no longer print theme names when the applied, nor when the original theme is re-applied. (#2031) -
Updated the
theme_gtsummary_journal("jama")
theme to apply changes totbl_svysummary()
. (#1964; @vjcatharine)
Lifecycle Updates
- Removed
global_pvalue_fun.tidycrr()
, which was previously migrated to the {tidycmprsk} package. (#1997; @jwoolfolk)
Bug Fixes
-
Bug fix for footnote markers when placing a footnote for flextable and gt tables on multiple columns and rows in the table body. (#2062)
-
Fix for setting default formatting functions in
tbl_svysummary()
. Previously, defaults were assigned similarly to those intbl_summary()
, which led to survey-only statistics being assigned sub-optimal defaults. (#2078) -
Bug fix in
add_ci.tbl_svysummary()
for factor variables where order was alphabetical instead of the factor levels. (#2036) -
Addressing encoding issue where
sort()
anddplyr::arrange()
sorted differently, and the order of theby
levels was inconsistent in the resulting table. (#2038) -
Users may now pass a vector of integers to
tbl_hierarchical*(digits)
, as is possible in other summary functions. (#2080)
gtsummary 2.0.3
New Features and Functions
-
Added function
tbl_hierarchical()
,tbl_hierarchical_count()
,tbl_ard_hierarchical()
,brdg_hierarchical()
, andpier_summary_hierarchical()
. Consider these functions as a preview. We will be making changes without the full deprecation cycle in the coming releases. (#1872) -
Adding the
style_*(prefix, suffix)
andlabel_style_*(prefix, suffix)
for adding a string before or after the formatted results. These arguments have not been added to the p-value formatting functions. (#1690) -
Added argument
tbl_ard_summary(overall)
. WhenTRUE
, the ARD is parsed into primary ARD and the Overall ARD and we runtbl_ard_summary() |> add_overall()
. (#1940) -
Added
add_stat_label.tbl_ard_summary()
method. (#1969)
Other Updates
-
Headers in {gt} tables being exported to PDF do not support the
\n
line breaker. Previously, line breakers were stripped from the header in theprint.gtsummary()
S3 method. But this did not apply to users utilizingas_gt()
to further customize their tables. As a result, the line breaking strip has been migrated toas_gt()
. (#1960) -
Migrated the
tbl_survfit.list(conf.level)
up totbl_survfit.data.frame(conf.level)
where the confidence level is passed tosurvival::survfit()
. -
Update in
tbl_ard_summary()
to better handle non-standard ARDs (i.e. not our typical continuous or categorical summaries) by assigning them a default summary type. (#1991) -
Made the
oneway.test()
available inadd_p.tbl_continuous()
. (#1970) -
Removed the deprecated
'aov'
test from thetests.R
file listing available tests. (#1970) -
Removed documentation for the
add_overall.tbl_ard_summary(digits)
argument, which was never meant to be a part of this function. (#1975)
Bug Fixes
-
Bug fix in
add_overall.tbl_custom_summary()
due to extraneous argument being passed totbl_custom_summary()
. (#2027) -
Bug fix in
add_p.tbl_survfit()
when the original call includedtbl_survfit(type)
specification. (#2002) -
Removed the
"tbl_summary-arg:statistic"
theme that was incorrectly added totbl_continuous()
.
gtsummary 2.0.2
Updates to address regressions in the v2.0.0 release:
- The default
add_glance_*(glance_fun)
function fixed formice
models with class'mira'
. (#1912) - We can again report unweighted statistics in the headers of
tbl_svysummary()
tables. (#1911) tbl_uvregression()
properly handles variables specified in theinclude
argument with non-syntactic names. (#1932)NA
values can again be specified inadd_stat_label(label)
to suppress a statistic label from being placed. (#1937)- Corrected bug in
tbl_cross()
where thedigits
argument was not always being passed accurately totbl_summary()
. (#1943)
Other updates
-
The total N is now returned with
.$cards
using thecards::ard_total_n()
function for the calculation. -
The default headers for
tbl_ard_*()
functions no longer include counts, as these are not required data to be passed along in the ARD input. -
The summary statistics of the
'by'
variable are no longer required in the ARD for functionstbl_ard_summary()
andtbl_ard_continuous()
. When the tabulation summary statistics are passed, they are available to place in the header dynamically. (#1860) -
The
tbl_ard_wide_summary()
function no longer requires the results fromcards::ard_attributes()
to create tables. (#1873) -
Added the
label
argument to functionstbl_ard_summary()
,tbl_ard_wide_summary()
, andtbl_ard_continuous()
. (#1850) -
The
add_glance*(glance_fun)
argument's default value has been updated to an S3 generic, allowing bespoke handling for some regression classes. (#1822) -
Added
add_overall.tbl_ard_summary()
S3 method. (#1848) -
Added function
tbl_likert()
for summarizing ordered categorical (or Likert scales) data as well as the associatedadd_n.tbl_likert()
S3 method. (#1660) -
Fix where error or warning condition messages containing curly brace pairs could not be printed.
-
Updated the
show_header_names()
output to include the values that may be dynamically placed in the headers. Additionally, theinclude_example
andquiet
arguments have been deprecated. (#1696)
gtsummary 2.0.1
Updates to address regressions in the v2.0.0 release:
- Restore functionality of
inline_text.tbl_summary(column)
argument to specify a by level when the by variable is a factor. (#1883) - Correct the order of the columns when the
tbl_summary(by)
variables has ten or more levels. (#1877) - Re-establishing strong link between header by variable levels and those in the table body to ensure correct ordering of columns in
tbl_summary()
. - The
tbl_survfit(times)
argument accepts integers once again. (#1867) - Fix in
tbl_uvregression()
for theformula
argument when it includes a hard-coded column name, e.g.formula='{y} ~ {x} + grade'
. The hard-coded variable name is now removed from theinclude
argument. (#1886) - Fix for non-Base R classes tabulated with
tbl_summary()
that would not coerce to character correctly afterunlist()
. (#1893) - Updated the styling function from
style_percent()
tostyle_number(scale=100)
when user passes an integer to change the rounding of percentages intbl_summary()
. (#1899)
Other updates
-
The {tidycmprsk} dependency has been removed and the
tbl_regression.tidycrr()
method has been migrated to the {tidycmprsk} package. (#1865) -
The class of
tbl_split()
objects has been updated from"tbl_split"
toc("tbl_split", "list")
. (#1854) -
Updated the default value of
tbl_ard_summary(missing)
to"no"
. (#1857) -
Line breaks (i.e.
'\n'
) are now auto-stripped from gt-rendered tables when in an R markdown or Quarto environment. (#1896)
gtsummary 2.0.0
New Features
-
Clearer error messages have been introduced throughout the package. We've adopted {cli} for all our messaging to users. Our goal was to return a clear message to users for all scenarios.
-
Added functions
tbl_wide_summary()
andtbl_ard_wide_summary()
for simple summaries across multiple columns. -
The {gt} package is now the default printer for all Quarto and R markdown output formats.
- Previously, when printing a gtsummary table in a Quarto or R markdown document, we would detect the output format and convert to gt, flextable, or kable to provide the best-looking table. The {gt} package has matured and provides lovely tables for nearly all output types, and we have now made {gt} the default table drawing tool for all gtsummary tables. These output types are still supported.
-
Previously, if I wanted a single statistic to be reported to additional levels of precision in a
tbl_summary()
table, I would need to specify the precision of every summary statistic for a variable. Now, we can simple update the one statistic we're interested in with a named list of vector:tbl_summary(digits = age ~ list(sd = 2))
. -
New functions
tbl_ard_summary()
andtbl_ard_continuous()
have been added. These provide general tools for creating bespoke summary tables. Rather than accepting a data frame, these functions accept an ARD object (Analysis Results Dataset often created with the {cards} or {cardx} packages). The ARD objects align with the emerging CDISC Analysis Results Standard. ARDs are now used throughout the package. See below under the "Internal Storage" heading. -
The default
add_global_p(anova_fun)
argument value has been updated toglobal_pvalue_fun()
, which is an S3 generic. The default method still callscar::Anova()
for the calculation. Methods fortidycmprsk::crr()
andgeepack::geeglm()
have been added that wrapaod::wald.test()
as these regression model types are not supported bycar::Anova()
. -
The
add_ci.tbl_summary()
S3 method has been updated with new ways to calculate the confidence interval: Wald with and without continuity correction, Agresti-Coull, and Jeffreys. -
Added a family of function
label_style_*()
that are similar to thestyle_*()
except they return a styling function, rather than a styled value. -
Functions
tbl_summary()
andtbl_svysummary()
have gained themissing_stat
argument, which gives users great control over the statistics presented in the missing row of a summary table.
Internal Storage
-
Greater consistency has been put in place for all calculated statistics in gtsummary. Previously, each function handled its own calculations and transforming these statistics into data frames that would be printed. Now each function will first prepare an Analysis Result Dataset (ARD), and ARDs are converted to gtsummary structures using bridge functions (prefixed with
brdg_*()
). The bridge functions will be exported to allow anyone to more easily extend gtsummary functions.- These ARDs are now used to calculate the summary statistics for nearly every function in gtsummary. The raw summary statistics are saved in
.$cards
. - Users who previously accessed the internals of a gtsummary object will find the structure has been updated, and this may be an important breaking change.
- These ARDs are now used to calculate the summary statistics for nearly every function in gtsummary. The raw summary statistics are saved in
-
Calculations that require other packages have been placed in another package called {cardx}. This package creates ARD objects with the calculated statistics.
-
In
tbl_regression()
, the.$model_obj
is no longer returned with the object. The modeling object is, and always has been, available in.$inputs$x
. -
When the gtsummary package was first written, the gt package was not on CRAN and the version of the package that was available did not have the ability to merge columns. Due to these limitations, the
"ci"
column was added to show the combined"conf.low"
and"conf.high"
columns. Column merging in both gt and gtsummary packages has matured over the years, and we are now adopting a more modern approach by using these features. As a result, the"ci"
column will eventually be dropped from.$table_body
. By using column merging, the conf.low and conf.high remain numeric and we can to continue to update how these columns are formatted. Review?deprecated_ci_column
for details.
Documentation
- The vignettes "FAQ+Gallery",
tbl_summary()
Tutorial,tbl_regression()
Tutorial, and Quarto+R Markdown have been converted to articles. The URLs on the website have not changed for these pages, but the vignettes are no longer is bundled in the package. This change allows us to provide better documentation, utilizing more tools that don't need to be included in the package.
Minor Improvements
-
Argument
add_p.tbl_summary(adj.vars)
was added to more easily add p-values that are adjusted/stratified by other columns in a data frame. -
Messaging and checks have been improved when tidyselect is invoked in the package, i.e. when the tilda is used to select variables
age ~ "Patient Age"
. The subset of variables that can be selected is now reduced the variables present in the table. For example, if you have a summary table of patient age (and only patient age), and age is a single column from a data set of many columns and you mis-spell age (aggge ~ "Patient Age"
), the error message will now ask if you meant"age"
instead of listing every column in the data set.- Note that as before, you can circumvent tidyselect by using a named list, e.g.
list(age = "Patient Age")
.
- Note that as before, you can circumvent tidyselect by using a named list, e.g.
-
Added the following methods for calculating differences in
add_difference.tbl_summary()
: Hedge's G, Paired data Cohen's D, and Paired data Hedge's G. All three are powered by the {effectsize} package. -
The counts in the header of
tbl_summary(by)
tables now appear on a new line, e.g."**{level}** \nN = {n}"
. -
In
tbl_summary()
, the default calculation for quantiles (e.g. statistics of the form"p25"
or"p75"
) has been updated with typequantile(type=2)
. -
In
tbl_summary()
, dates and times showed the minimum and maximum values only by default. They are now treated as all other continuous summaries and share their default statistics of the median and IQR. -
Previously, indentation was handled with
modify_table_styling(text_format = c("indent", "indent2"))
, which would indent a cell 4 and 8 spaces, respectively. Handling of indentation has been migrated tomodify_table_styling(indent = integer())
, and by default, the label column is indented to zero spaces. This makes it easier to indent a group of rows. -
The inputs for
modify_table_styling(undo_text_format)
has been updated to mirror its counterpartmodify_table_styling(text_format)
and no longer acceptsTRUE
orFALSE
. -
The values passed in
tbl_summary(value)
are now only checked for columns that are summary type"dichotomous"
. -
The gtsummary selecting functions, e.g.
all_categorical()
,all_continuous()
, etc., are now simplified by wrappingtidyselect::where()
, which not available when these functions were originally written. Previously, these functions would error if used out of context; they now, instead,select no columns when used out-of-context. -
The design-based t-test has been added as possible methods for
add_difference.tbl_svysummary()
and is now the default for continuous variables. -
When
add_ci()
is run afteradd_overall()
, the overall column is now populated with the confidence interval. (#1569) -
Added
pkgdown_print.gtsummary()
method that is only registered when the pkgdown package is loaded. This enables printing of gtsummary tables on the pkgdown site in the Examples section. (#1771) -
The package now uses updated
survey::svyquantile()
function to calculate quatiles, which was introduced in survey v4.1
Bug fixes
- Fix in
add_difference()
for paired t-tests. Previously, the sign of the reported difference depended on which group appeared first in the source data. Function has been updated to consistently report the difference as the first group mean minus the second group mean. (#1557)
Lifecycle changes
-
A couple of small changes to the default summary type in
tbl_summary()
have been made.- If a column is all
NA_character_
intbl_summary()
, the default summary type is now"continuous"
, where previously it was"dichotomous"
. - Previously, in a
tbl_summary()
variables that werec(0, 1)
,c("no", "yes")
,c("No", "Yes")
, andc("NO", "YES")
would default to a dichotomous summary with the1
andyes
level being shown in the table. This would occur even in the case when, for example, only0
was observed. In this release, the line shown for dichotomous variables must be observed OR the unobserved level must be either explicitly defined in a factor or be a logical vector. This means that a character vector of all"yes"
or all"no"
values will default to a categorical summary instead of dichotomous.
- If a column is all
-
When using the
tbl_summary(value)
argument, we no longer allow unobserved levels to be used unless it is an unobserved factor level or logical level. -
The
quiet
argument has been deprecated throughout the package, except intbl_stack()
. Documentation has been updated to ensure clarity in all methods. -
The
inline_text(level)
argument now expects a character value. -
The
tbl_butcher(include)
argument now only accepts character vectors. -
The following theme elements have been deprecated:
- These theme elements will eventually be removed from the package:
'tbl_summary-arg:label'
,'add_p.tbl_summary-arg:pvalue_fun'
,'tbl_regression-arg:pvalue_fun'
,'tbl_regression-chr:tidy_columns'
.- The
pvalue_fun
elements should switch to the package-wide theme for p-value styling--'pkgwide-fn:pvalue_fun'
.
- The
- These theme elements have been removed from the package immediately due to str...
- These theme elements will eventually be removed from the package:
gtsummary 1.7.2
-
Removed messaging about the former auto-removal of the
tbl_summary(group)
variable from the table: a change that occurred 3+ years ago in gtsummary v1.3.1 -
Fix in
as_flex_table()
where source notes were not accurately rendered. (#1520) -
Fix in column order when
add_ci()
is run afteradd_overall(last=TRUE)
. Previously, the overall columns were placed in front. (#1525) -
Line breaks (i.e.
\n
) are now removed from column headers and table cells whenas_kable()
is called. (#1526) -
Fix in
as_gt()
where columns with common spanning headers were gathered. Corrected withgt::tab_spanner(gather = FALSE)
. (#1527) -
Fix in
remove_row_type()
where header rows forcontinuous2
type variables was not removed when requested. (#1507) -
Fix where some default
add_p.tbl_summary()
categorical tests were chi-squared when it should have been Fisher's exact test. This misclassification occurred in some cases when there was a large differential in the missing pattern for one of the variables in the cross table. (#1513) -
Fix in
add_overall(col_label=)
where specified label was not always placed. (#1505)