Repository navigation
New features
-
The new
rows_hide()androws_unhide()functions control row visibility, mirroringcols_hide()andcols_unhide(). Hidden rows are excluded from the rendered table but can still be targeted inrowsexpressions, and summary rows are calculated from the visible rows only. (#2127) -
Numeric formatting functions (
fmt_number(),fmt_scientific(),fmt_engineering(),fmt_percent(),fmt_currency(), and others) gain adrop_leading_zeroargument. Setting this toTRUEremoves the leading zero from values between -1 and 1 (e.g.,0.75becomes.75), which is useful for displaying correlations, p-values, and other bounded statistics (#2146). (#2155) -
Tables can now be saved as PowerPoint files with
gtsave()by using the.pptxfile extension. This is powered by a new OOXML rendering engine that aims to unify Word and PowerPoint output (#97). (@thebioengineer, @romainfrancois, #2158) -
gt_group()can now combinegt_groupobjects withgt_tblobjects (#2128). (@shannonhaughton, #2129) -
Tables with no data rows now display a locale-appropriate message (e.g.,
"Table has no data") in the body area for both HTML and LaTeX output. The message can be customized viatab_options(table.no_data_message = "...")or suppressed by setting it to""(#1881).
Upcoming changes
- gt's internals and documentation now use the base pipe (
|>) throughout. gt still re-exports%>%,dplyr::vars(), andtidyselect::one_of(), but these re-exports will be removed in a future release. Packages relying on them should import them directly from magrittr, dplyr, or tidyselect. (@olivroy, #2150)
Minor improvements and bug fixes
-
Fixed LaTeX and RTF output for unformatted
Datecolumns, which now show calendar dates instead of day counts since the Unix epoch (#2177). (@LeonidasZhak, #2180) -
Rows in LaTeX output tables no longer overlap when cell text contains line breaks (#2178). (#2179)
-
Fixed
cols_merge()with<</>>patterns producing corrupted output when data values contain<or>characters, particularly in LaTeX output (#2153). (#2156) -
Fixed
gt_split()failing on grouped data frames by filtering stale row group metadata after subsetting rows (#2089). (#2157) -
Fixed
md()in a column label causing the column to expand to full page width (\linewidth) in LaTeX/PDF output when no explicit column width is set (#2124). (#2162) -
Fixed
text_transform()passing HTML-escaped text (e.g.,&) to the user-supplied function instead of the original display text; functions likestringr::str_to_title()now receive and transform plain text as expected (#2033). (#2163) -
Fixed
text_replace()failing to match patterns containing LaTeX special characters (e.g., underscores) in LaTeX/PDF output. The same plain-text pattern now works consistently in both HTML and LaTeX (#1592). (#2165) -
Styles applied with
tab_style()tocells_column_spanners()are no longer dropped whentab_style()is called beforetab_spanner()(#1438). (#2174) -
The
headersattributes on<td>elements in HTML output tables now match theidattributes of their column headings when column names contain spaces, improving accessibility (#2085). (#2173) -
The vertical alignment of the row group column (with
row_group_as_column = TRUE) can now be set withtab_style()through body cell styles. (#2176) -
Fixed cell misalignment when using
summary_rows(side = "top")withrow_group.as_column = TRUEand no stub column (#1561). (#2175) -
Styling can now be applied to summary rows in LaTeX output tables without error (#2117). (@thebioengineer, #2123)
-
Fixed multi-column stub rowspans incorrectly crossing row-group boundaries when adjacent groups share the same stub value, which caused group labels to appear in the wrong rows (#2121). (#2161)
-
Fixed grand summary rows rendering incorrectly in HTML output tables with a multi-column stub (#2164). (@ChidiebereNjoku, #2167)
-
Fixed higher-level column spanners not displaying correctly when a multi-column stub is present (#2170). (@ysaidani, #2171)
-
Fixed
cells_stub()incorrectly resolving footnote row indices when a multi-column stub has repeated labels across non-contiguous groups (#2168). (@ysaidani, #2169) -
Improved RTF handling of column headers and spanners in tables with a multi-column stub (#2118). (@thebioengineer, #2145)
-
Empty strings marked with
md()are now handled correctly in Word output tables (#2119). (@thebioengineer, #2120) -
The
keep_with_nextparameter is now applied consistently inas_word()(#2149). (@shannonhaughton, #2151) -
Removed usage of
dplyr::case_match(), which is deprecated as of dplyr 1.2.0. (@olivroy, #2125) -
Fixed several typos in the documentation. (@jeis4wpi, #2152)