Skip to content

Commit 1605d99

Browse files
authored
Merge pull request #1761 from rstudio/v0.11.0-rc
Release gt v0.11.0
2 parents f9954e9 + 0fb6584 commit 1605d99

38 files changed

+315
-224
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gt
33
Title: Easily Create Presentation-Ready Display Tables
4-
Version: 0.10.1.9000
4+
Version: 0.11.0
55
Authors@R: c(
66
person("Richard", "Iannone", , "[email protected]", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0003-3925-190X")),

NEWS.md

Lines changed: 110 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,120 @@
1-
# gt (development version)
1+
# gt 0.11.0
22

3-
* `summary_rows()` now throws a more informative error message that you should use `grand_summary_rows()` if no row groups are detected (@olivroy, #1292).
4-
This change was introduced in [gt 0.9.0](https://posit.co/blog/big-changes-to-making-summary-rows-in-gt-0-9-0/)
5-
* gt now depends on R 3.6 (@olivroy, #1731).
3+
## New features
4+
5+
* **gt** tables can now be rendered in the grid graphics system with the new `as_gtable()` function (#180, #420, #509, #961, #1652, #1701). Thank you @teunbrand for this valuable contribution! (#1563, #1648, #1655, #1727)
6+
7+
* With the new `fmt_chem()` function, it's possible to format chemical formulas and chemical equations in the table body. (#1636)
8+
9+
* We added `fmt_email()` we can transform email addresses in table cells into usable 'mailto:' links. This operates similarly to `fmt_url()` but removes some unneeded anchor tag attributes (#1616). (#1649)
10+
11+
* The new `fmt_tf()` function lets you format logical values in a **gt** table. You could express these as a 'yes' or 'no', a 'true' or 'false', or, perhaps use pairings of complementary symbols that make sense in a table (#1650). (#1654)
12+
13+
* The new `fmt_country()` was added to help with making country names consistent and localizable. The input text can either consist of 2- or 3-letter ISO 3166-1 country codes. (#1645, #1696)
14+
15+
* Math formulas (written in LaTeX) can now be rendered to HTML through `md()` and `fmt_markdown()`. The LaTeX formulas can be set between `$` or `$$` delimiters for inline and block rendering styles. While this requires the **katex** package to work (it's an optional dependency), the rendering of formulas is dependency-free in the output (#375, #616, #1163). (#1578)
16+
17+
* We added the `unit_conversion()` helper function to help you perform unit conversions. This function returns a conversion factor for transforming a value from one form of measurement units to a target form. This works wonderfully in the `scale_by` argument that is present in many number-based `fmt_*()` functions. (#1704, #1709, #1710, #1729)
18+
19+
* The `plot()` method was added for `gt_tbl` so that one can quickly create a reprex visual example (e.g., `exibble |> gt() |> plot()`). (#1742)
20+
21+
* `info_time_style()` and `info_date_style()` gain a `locale` argument to preview time and date formatting in a specific locale. (#1747)
22+
23+
* `data_color()` throws a more informative error message if `rows` didn't resolve to anything (#1659). (@olivroy, #1660).
24+
25+
* Several datasets were added to the package: `reactions`, `photolysis`, `peeps`, `nuclides`, `gibraltar`, and `films`. (#1619, #1641, #1664, #1668, #1686, #1695)
26+
27+
## Improvements to the LaTeX output format
628

7-
* `info_time_style()` and `info_date_style()` gain a `locale` argument to preview datetime formatting in a given locale.
29+
* A host of improvements were made to LaTeX output such that styling made through `tab_options()` and `tab_style()` is now honored. The styling implemented now includes: (1) font size, underlining, italicizing, bolding, indenting text, coloring text, filling cell backgrounds, and modifying text case (i.e., uppercase, lowercase, sentence case) (#1472). (#1594, #1603, #1746, thanks so much @kbrevoort)
830

9-
* `opt_interactive()` gains `height` to help specify your widget's height (@olivroy, #1544).
31+
* Text in spanner labels is now nicely wrapped in LaTeX output, where before there would be no wrapping at all (#1656). (#1716, #1746)
1032

11-
* `opt_interactive()` now shows row names if `rownames_to_stub = TRUE` (@olivroy, #1702).
33+
* The `gt()` setting of `row_group_as_column == TRUE` is now implemented in LaTeX output. (#1716)
1234

13-
* `data_color()` throws a more informative error message if `rows` didn't resolve to anything (@olivroy, #1659).
35+
* LaTeX output now understands and can convert from lengths expressed in pixels (an internal conversion to pt units is performed) (#1582). (#1595)
36+
37+
* A fix was made to correct an error related to converting px units to pt units for LaTeX output. (#1591, thank you @AaronGullickson)
38+
39+
## Improvements to interactive HTML tables via `opt_interactive()`
40+
41+
* The performance of interactive table rendering through `opt_interactive()` has been improved (#1289). (#1735)
42+
43+
* `opt_interactive()` now shows row names if `rownames_to_stub = TRUE` (#1702). (@olivroy, #1706)
44+
45+
* There's now better support for displaying group columns, if present, in interactive tables (#1705). (@olivroy, #1725, #1758, #1760)
46+
47+
* Interactive tables can now display the stub header label created with `tab_stubhead()`. (@olivroy, #1758).
48+
49+
* There is no longer an error when having a hidden column under a spanner label in an interactive HTML table (i.e., `opt_interactive()`) context. (#1629)
50+
51+
* Interactive tables now render the first level of column groups added by `tab_spanner()` (#1618). Thanks @obsaditelnost for your work on this! (#1623)
52+
53+
* The `opt_interactive()` function now has the `height` argument to help specify the height of an interactive table (#1544). (@olivroy, #1723).
54+
55+
* When using `opt_interactive(use_pagination = FALSE)` the pagination controls are now entirely removed instead of merely being non-functional (#1542). (#1642)
56+
57+
* When supplying a locale value to an interactive table, we now ensure that the supplied locale is normalized (so `"fr_CH"` will be internally corrected to `"fr-CH"`) (#1637). (#1643)
58+
59+
## Minor improvements and bug fixes
1460

15-
* PDF output now allows the font size of a table to be set using the table.font.size parameter in the tab_options function (#1472). The font sizes of individual table cells (including those in the body, stubs, column headings, etc.) can be set using tab_style function. Several other options specified in tab_style are now reflected in PDF output.
61+
* The `fill_color` argument in `fmt_icon()` now allows the use of named vector/list to apply different colors to different icons (#1560). (#1647)
1662

17-
* `data_color()` throws a more informative error if a calculation failed (@olivroy, #1373).
63+
* `fmt_flag()` gains a `locale` argument so that SVG title text displays country names in any locale language. (#1645)
1864

19-
* `gtsave()` saves correctly to .rtf if using `cols_label()` and `summary_rows()` or `grand_summary_rows()` (@olivroy, #1233)
65+
* To better represent missing values in nanoplots, the `"marker"` option has been added in `cols_nanoplot()` (#1567). (#1587)
2066

21-
* interactive tables are now rendering the first level of column groups, added by `tab_spanner()` (@obsaditelnost, #1618)
67+
* Many of the `info_*()` functions were upgraded with better functionality and a refreshed look. (#1720, #1748, #1754)
2268

23-
* `cols_hide()` no longer errors if no column was supplied. Error messages are also clearer when supplying a column that doesn't exist (@olivroy, #1631).
69+
* The `metro` dataset has been updated with six new Line 11 stations that opened on 2024-06-13. (#1708)
2470

25-
* `cols_units()`, `tab_footnote()` and `tab_style()` now give better error messages when `locations` is not correctly specified (@olivroy, #475, #1638 , #1640, #1733).
71+
* For HTML tables produced in Quarto, we now use the `data-qmd-base64` attribute along with base64 text when passing Markdown text to Quarto (which handles the Markdown conversion) (#1487, #1488). (#1688, #1690, #1734)
2672

27-
* `opt_interactive()` has better support for displaying group columns if present (`row_groups_as_column` has no effect on the output) (@olivroy, #1705).
73+
* Scientific and engineering notation will no longer unexpectedly wrap lines in HTML for smaller column widths. (#1621)
74+
75+
* Footnote marks in HTML table outputs no longer unexpectedly increase the text line height (#1556). (#1644)
76+
77+
* We now ensure tables print correctly when called from inline code in `.qmd` or `.Rmd` documents (#1055). (#1689)
78+
79+
* `data_color()` throws a more informative error if an internal calculation failed (e.g., presence of infinite values) (#1373). (@olivroy, #1585)
80+
81+
* `data_color()` provides an informative error message if `rows` doesn't resolve to anything. (@olivroy, #1659)
82+
83+
* `summary_rows()` now throws a more informative error message that you should use `grand_summary_rows()` if no row groups are detected (#1292). (@olivroy, #1752)
84+
85+
* Boxplot-based nanoplots now correctly determine which data points are outliers. (#1756)
86+
87+
* The issue where having a row group set as a column in the stub, corrupting the setting of column widths in HTML output tables, has been fixed (#1253, #1510). (#1744)
88+
89+
* The rendering of footnotes and source notes received fixes to ensure that all requested notes are inserted and also that the typesetting options in `tab_options()` is implemented (#1505, #1615). (#1620, #1751)
90+
91+
* Using a `fmt_*()` function while the stub is composed of Markdown or HTML no longer results in an error (#1600). (#1627)
92+
93+
* The combination of using `cols_label()` + `summary_rows()` / `grand_summary_rows()` no longer causes an error for RTF output through `gtsave()` (#1233). (#1596)
94+
95+
* We now ensure that `id` values are stripped of HTML tags when using `tab_row_group()`. Previously this condition would create corrupted row group labels (#1143). (#1750)
96+
97+
* `cols_hide()` no longer errors if a column wasn't supplied. Error messages are also clearer when supplying a column that doesn't exist (#1631). (#1632)
98+
99+
* `cols_units()`, `tab_footnote()` and `tab_style()` now give better error messages when `locations` is not correctly specified (#475). (@olivroy, #1638, #1640, #1733)
100+
101+
* Error messages are now improved for `rm_spanners()`, `rm_footnotes()`, and `rm_source_notes()` (#1638). (#1661)
102+
103+
* Error messages for the `vec_*()` functions are now standardized with `check_vector_valid()`. (#1662)
104+
105+
* Running **testthat** tests no longer fails on Windows due to `gtsave()` path incompatibilities (#1626). (#1627)
106+
107+
* Tests run on Windows are less noisy now (no more render related warnings). (#1634)
108+
109+
* Much code refactoring, linting, and test improvements were performed by @olivroy, resulting in many performance gains. (#1666, #1683, #1694, #1699, #1715, #1718, #1728, #1730, #1731, #1732, #1733, #1753)
110+
111+
* **gt** now depends on R 3.6. (#1599, #1731).
112+
113+
## Documentation enhancements
114+
115+
* Many small documentation fixes were performed. (#1555, #1598, #1633, #1658, #1663, #1676, #1685, #1700, #1703, #1717, #1719, #1721)
116+
117+
* More examples were added to further demonstrate how various functions can be used. (#1646, #1667, #1677, #1698, #1724, #1737)
28118

29119
# gt 0.10.1
30120

@@ -44,12 +134,14 @@
44134

45135
* Introduced a small performance improvement by no longer calling `utils::packageVersion()` internally (#1524). (#1525, thank you @slodge)
46136

47-
* Code and test refactoring was performed to generally improve performance and code readability. (#1480, thanks @olivroy)
48-
* The `gtsave()` function now returns the file path invisibly instead of `TRUE`. (#1478, thank you @olivroy)
137+
* Code and test refactoring was performed to generally improve performance and code readability. (#1480)
138+
139+
* The `gtsave()` function now returns the file path invisibly instead of `TRUE`. (#1478)
49140

50-
* Most functions now produce better error messages if not provided with a `gt_tbl` object. (#1504, c/o @olivroy)
141+
* Most functions now produce better error messages if not provided with a `gt_tbl` object. (#1504, #1624)
51142

52143
* The URL formatting through `fmt_url()` has been improved by preventing link text breaking across lines (#1509). (#1537)
144+
53145
* We now remove some unnecessary newlines in the HTML text produced by `as_raw_html()`, which caused an issue when integrating **gt** tables into **blastula** email messages (#1506). (#1520)
54146

55147
* The `tab_spanner_delim()` now lets you use `delim` strings longer than a single character (#1469). (#1513)

R/datasets.R

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
#' \itemize{
288288
#' \item `"brie_carre"`: The Brie Carre Pizza (Brie Carre Cheese, Prosciutto,
289289
#' Caramelized Onions, Pears, Thyme, Garlic)
290-
#' \item `"calabrese"`: The Calabrese Pizza (Nduja Salami, Pancetta,
290+
#' \item `"calabrese"`: The Calabrese Pizza ('Nduja Salami, Pancetta,
291291
#' Tomatoes, Red Onions, Friggitello Peppers, Garlic)
292292
#' \item `"soppressata"`: The Soppressata Pizza (Soppressata Salami, Fontina
293293
#' Cheese, Mozzarella Cheese, Mushrooms, Garlic)
@@ -527,14 +527,6 @@
527527
#' centimeters (cm) and kilograms (kg), respectively.}
528528
#' }
529529
#'
530-
#' @section Examples:
531-
#'
532-
#' Here is a glimpse at the data available in `peeps`.
533-
#'
534-
#' ```{r}
535-
#' dplyr::glimpse(peeps)
536-
#' ```
537-
#'
538530
#' @family datasets
539531
#' @section Dataset ID and Badge:
540532
#' DATA-8
@@ -544,7 +536,7 @@
544536
#' }}
545537
#'
546538
#' @section Dataset Introduced:
547-
#' *In Development*
539+
#' `v0.11.0`
548540
#'
549541
"peeps"
550542

@@ -576,7 +568,7 @@
576568
#' production. Here, 2-letter ISO 3166-1 country codes (set in uppercase) are
577569
#' used.}
578570
#' \item{run_time}{The run time of the film in hours and minutes. This is given
579-
#' as a string in the format '<x>h <y>m'.}
571+
#' as a string in the format `[x]h [y]m`.}
580572
#' \item{imdb_url}{The URL of the film's information page in the Internet Movie
581573
#' Database (IMDB).}
582574
#' }
@@ -598,7 +590,7 @@
598590
#' }}
599591
#'
600592
#' @section Dataset Introduced:
601-
#' *In Development*
593+
#' `v0.11.0`
602594
#'
603595
"films"
604596

@@ -656,14 +648,6 @@
656648
#' show `NA` values.}
657649
#' }
658650
#'
659-
#' @section Examples:
660-
#'
661-
#' Here is a glimpse at the data available in `metro`.
662-
#'
663-
#' ```{r}
664-
#' dplyr::glimpse(metro)
665-
#' ```
666-
#'
667651
#' @family datasets
668652
#' @section Dataset ID and Badge:
669653
#' DATA-10
@@ -719,7 +703,7 @@
719703
#' }}
720704
#'
721705
#' @section Dataset Introduced:
722-
#' *In Development*
706+
#' `v0.11.0`
723707
#'
724708
"gibraltar"
725709

@@ -965,7 +949,7 @@
965949
#' }}
966950
#'
967951
#' @section Dataset Introduced:
968-
#' *In Development*
952+
#' `v0.11.0`
969953
#'
970954
"reactions"
971955

@@ -1024,7 +1008,7 @@
10241008
#' }}
10251009
#'
10261010
#' @section Dataset Introduced:
1027-
#' *In Development*
1011+
#' `v0.11.0`
10281012
#'
10291013
"photolysis"
10301014

@@ -1085,7 +1069,7 @@
10851069
#' }}
10861070
#'
10871071
#' @section Dataset Introduced:
1088-
#' *In Development*
1072+
#' `v0.11.0`
10891073
#'
10901074
"nuclides"
10911075

R/export.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,12 +1161,13 @@ as_word_tbl_body <- function(
11611161
#' The `plot` option determines whether the `gtable` object should be rendered
11621162
#' on the graphics device.
11631163
#'
1164-
#' @param text_grob
1164+
#' @param text_grob *Function for drawing text*
11651165
#'
11661166
#' `function` // *default:* `grid::textGrob`
11671167
#'
1168-
#' A `function` used to draw text. Defaults to `grid::textGrob()` but can be
1169-
#' swapped to `gridtext::richtext_grob()` to better render HTML content.
1168+
#' A `function` which will be used to draw text. Defaults to
1169+
#' `grid::textGrob()` but can be swapped to `gridtext::richtext_grob()` to
1170+
#' better render HTML content.
11701171
#'
11711172
#' @return A `gtable` object.
11721173
#'
@@ -1175,7 +1176,7 @@ as_word_tbl_body <- function(
11751176
#' 13-6
11761177
#'
11771178
#' @section Function Introduced:
1178-
#' *In Development*
1179+
#' `v0.11.0`
11791180
#'
11801181
#' @export
11811182
as_gtable <- function(data, plot = FALSE, text_grob = grid::textGrob) {

R/format_data.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ fmt_integer <- function(
11821182
#' gt(rowname_col = "cmpd_name") |>
11831183
#' tab_header(title = "Gas-phase reactions of selected mercaptan compounds") |>
11841184
#' tab_spanner(
1185-
#' label = md("Reaction Rate Constant (298 K),<br>{{cm^3 molecules^1 s^1}}"),
1185+
#' label = md("Reaction Rate Constant (298 K),<br>{{cm^3 molecules^-1 s^-1}}"),
11861186
#' columns = ends_with("k298")
11871187
#' ) |>
11881188
#' fmt_chem(columns = cmpd_formula) |>
@@ -8562,7 +8562,7 @@ format_bins_by_context <- function(x, sep, fmt, context) {
85628562
#' 3-18
85638563
#'
85648564
#' @section Function Introduced:
8565-
#' *In Development*
8565+
#' `v0.11.0`
85668566
#'
85678567
#' @export
85688568
fmt_tf <- function(
@@ -9286,7 +9286,7 @@ fmt_units <- function(
92869286
#' 3-20
92879287
#'
92889288
#' @section Function Introduced:
9289-
#' *In Development*
9289+
#' `v0.11.0`
92909290
#'
92919291
#' @export
92929292
fmt_chem <- function(
@@ -10438,7 +10438,7 @@ add_anchor_attr <- function(
1043810438
#' 3-22
1043910439
#'
1044010440
#' @section Function Introduced:
10441-
#' *In Development*
10441+
#' `v0.11.0`
1044210442
#'
1044310443
#' @export
1044410444
fmt_email <- function(
@@ -12186,7 +12186,7 @@ fmt_flag <- function(
1218612186
#' 3-25
1218712187
#'
1218812188
#' @section Function Introduced:
12189-
#' *In Development*
12189+
#' `v0.11.0`
1219012190
#'
1219112191
#' @export
1219212192
fmt_country <- function(
@@ -13036,11 +13036,11 @@ fmt_icon <- function(
1303613036
#' text_1a <- "
1303713037
#' ### This is Markdown.
1303813038
#'
13039-
#' Markdowns syntax is comprised entirely of
13039+
#' Markdown's syntax is comprised entirely of
1304013040
#' punctuation characters, which punctuation
1304113041
#' characters have been carefully chosen so as
1304213042
#' to look like what they mean... assuming
13043-
#' youve ever used email.
13043+
#' you've ever used email.
1304413044
#' "
1304513045
#'
1304613046
#' text_1b <- "

0 commit comments

Comments
 (0)