diff --git a/NEWS.md b/NEWS.md index cd1d0a0cd5..e6352608f2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -29,6 +29,10 @@ * Fixed a bug in using `pct()` column widths with `as_gtable()` (@teunbrand, #1771) +* Fixed a bug where `gt(row_group_as_column = TRUE)` would create the wrong layout with `as_gtable()` when all groups are unique (@olivroy, #1803). + +* grid output has been improved. Namely, showing currency symbols now works (@olivroy, #1788). + * `data_color()` no longer errors when a tidyselect selection is empty (like `fmt_*()` functions) (@olivroy, #1665). * `gt(row_group_as_column = TRUE)` now works if multiple groups are supplied (@olivroy, #1552). diff --git a/R/utils_render_grid.R b/R/utils_render_grid.R index 2c7424d313..a972584fd7 100644 --- a/R/utils_render_grid.R +++ b/R/utils_render_grid.R @@ -566,6 +566,9 @@ body_cells_g <- function(data) { if (has_length(delete)) { # don't if delete doesn't have length. # will likely occur in the case of + if (rlang::has_length(delete)) { + # don't attempt delete doesn't have length + # will likely occur in the case of all groups of length 1 #1803 layout <- vctrs::vec_slice(layout, -delete) cell_rows <- vctrs::vec_slice(cell_rows, -delete) } diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index c8db36101a..0b99d01b20 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -7,6 +7,7 @@ home: template: bootstrap: 5 + light-switch: true assets: pkgdown/assets authors: @@ -361,10 +362,10 @@ reference: - title: Built in datasets desc: > - The **gt** package is equipped with twelve datasets that come in all - shapes and sizes. Use them to experiment with the package! Many examples - in the internal help documents use these datasets to quickly demonstrate - the awesome features of **gt**. + The **gt** package is equipped with 18 datasets that come in all shapes + and sizes. Use them to experiment with the package! Many examples in the + documentation use these datasets to demonstrate the awesome features of + **gt**. contents: - countrypops - sza diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 83d77b33d0..cf22d5819a 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -25,7 +25,6 @@ h4, .h4 { } dt { - color: rgb(38, 38, 38); text-decoration: underline; text-decoration-style: solid; text-underline-offset: 4px; diff --git a/tests/testthat/test-as_gtable.R b/tests/testthat/test-as_gtable.R index ea62c64551..9c5f2b23b2 100644 --- a/tests/testthat/test-as_gtable.R +++ b/tests/testthat/test-as_gtable.R @@ -178,9 +178,10 @@ test_that("gtable outputs works well for currencies", { ) }) -test_that("gtable output works when row_group_as_column = TRUE and groups are unique", { +test_that("gtable output works when row groups are unique (#1802).", { + # using groupname_col = "row" to ensure uniqueness tbl <- exibble %>% - gt(groupname_col = "row", row_group_as_column = TRUE) + gt(groupname_col = "row") expect_no_error(test <- as_gtable(tbl)) expect_equal( test$layout$name[8],