Deprecate gt in favor of lt - #629
Conversation
Remove the gt package dependency entirely and use the lightweight lt package for table rendering. This reduces install weight and aligns with the project's move toward minimal dependencies. Changes: - New as_lt() generic + methods replacing as_gt() - All vignettes updated: gt() → lt(), tab_header() → lt_header(), fmt_number() → lt_format(), tab_spanner() → lt_spanner(), tab_footnote() → lt_footnote()/lt_note(), cols_label() → lt_cols_label() - README.Rmd: use knitr::kable() for GitHub rendering - DESCRIPTION: gt removed from Imports, lt added - Tests updated for lt_tbl assertions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lt requires character strings for column names (unlike gt's tidy-select). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jdblischak
left a comment
There was a problem hiding this comment.
When I run the tests locally, I get two failures:
library("testit")
test_pkg()
## Error: -- Assertion failed: as_lt: footnote=FALSE removes footnote --
## 1. count_footnotes(z1) (LHS) ==>
## int 0
## ----------
## int 1
## <== (RHS) 1L
## count_footnotes(z1) %==% 1L is not TRUE but FALSE at tests/testit/test-developer-as_lt.R#14
## 2. count_footnotes(z1) (LHS) ==>
## int 0
## ----------
## int 2
## <== (RHS) 2L
## count_footnotes(z1) %==% 2L is not TRUE but FALSE at tests/testit/test-developer-as_lt.R#22
sessioninfo::package_info(c("gsDesign2", "lt"), dependencies = FALSE)
## package * version date (UTC) lib source
## gsDesign2 * 1.1.8 2026-05-28 [1] local
## lt 0.0.7 2026-05-28 [1] Github (yihui/lt@e485eb6)
##
## [1] C:/Users/john/AppData/Local/R/win-library/4.4
## [2] C:/Program Files/R/R-4.4.3/library
## * ── Packages attached to the search path.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
- Restore as_gt() as a thin, deprecated wrapper that warns and delegates to as_lt(), so existing users get a migration path instead of a hard break. - Bundle inst/css/gt-style.css and apply it from both as_lt() methods via lt::lt_css(), making lt output nearly indistinguishable from the old gt tables (top caption, light-grey rules, system-ui font, bare footnote superscripts). lt dedups the stylesheet across a knitted document. - Fix count_footnotes() test helper to read $footnotes (where lt_footnote stores them) instead of $ops. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
as_gt() is exported again (as a deprecated wrapper), so pkgdown requires it in the reference index. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop properties already set by lt's default stylesheet or by browser defaults (caption-side, empty-spanner border, normal-weight subtitle/th), keeping only the rules that actually change the appearance toward gt. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the gt-era prose; the help page now just states as_gt() is superseded by as_lt() and points there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
lt now ships the gt-like theme as lt-gt.css and lt_css() resolves bare filenames against the package, so gsDesign2 no longer needs its own copy. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
lt's default stylesheet is now gt-like, so as_lt() no longer needs to attach a separate theme via lt_css(). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Define lt.fixed_design_summary() and lt.gs_design_summary() that dispatch when users call lt::lt() on gsDesign2 summary objects. as_lt() is removed (never released). as_gt() remains as a deprecated wrapper pointing to lt::lt(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lt_cols_label doesn't exist in lt; the correct function is lt_label. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Just a quick update: I've submitted lt v0.1 to CRAN. Currently there are 132 newbies in the queue. I guess the initial review may take place a week later. Fingers crossed. |
* Update DESCRIPTION and NEWS.md for v1.1.9 * Fix grammar * I guess 2x is not that substantial [ci skip] --------- Co-authored-by: Yihui Xie <xie@yihui.name>
- Remove `Remotes: yihui/lt` since lt is now on CRAN - Remove redundant `lt::` prefix in vignettes where library(lt) is loaded - Add library(lt) to story-seven-test-types.Rmd - Delete gt_to_latex snapshot tests (gt no longer available) - Bump version to 1.2.0; update NEWS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace dual-block pattern (eval=FALSE lt() + hidden knitr::kable()) with single lt() calls rendered via lt_html(fragment=TRUE, css=FALSE). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the gt package dependency with the lightweight lt package for all table output, mirroring Merck/gsDesign2#629. - Add lt.gsBinomialExactTable() S3 method (R/as_lt.R) and deprecate as_gt() in favor of lt::lt(). - Swap gt for lt in DESCRIPTION Imports; add Remotes: yihui/lt pending the next lt release on CRAN. - Migrate all table-bearing vignettes to lt, dropping the bundled html_vignette CSS in favor of a minimal vignettes/vignette.css. - Update tests, docs, and _pkgdown.yml accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The committed README.md was built against an older lt where lt() on a design summary did not emit the caption title and footnotes. Rebuild it with the current lt so the fixed-design and group-sequential summary tables show their titles and footnotes again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Good catch — thanks. The committed
This one is a deliberate {lt} vs {gt} difference rather than something gsDesign2 sets. Neither |
Address PR review: the file defines S3 methods for lt::lt(), so name it R/lt.R to match the generic. Also add [lt-methods] to as_gt()'s @Seealso so users can find the gsDesign2 lt() methods. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resolve conflicts from the harm-bound feature (#640) landing on main while this branch replaces gt with lt: - DESCRIPTION: keep version 1.2.0; Imports lt (not gt). - NEWS.md: keep both the gt->lt 'Major changes' note and main's harm 'New features'/'Documentation' entries; reword the table entry to say lt() (with deprecated as_gt()) instead of as_gt(). - R/as_gt.R + man/as_gt.Rd: keep the deprecation shim; as_gt() is no longer an S3 generic, so main's as_gt.* method edits (incl. as_gt.simtrial_gs_wlr) don't apply. - R/lt.R: port main's harm changes into the lt S3 methods -- factor Bound on the display levels, arrange by (Analysis, Bound), compute alpha from the Efficacy bound, and default display_bound to include 'Harm'. - tests/testit/test-independent-as_gt.md: keep it deleted (gt_to_latex snapshots removed with the gt dependency). - vignettes/articles/story-harm-bound-schoenfeld.Rmd (new on main): convert gt()/fmt_number()/fmt_scientific()/groupname_col to lt()/lt_format()/ lt_group(); pre-format scientific columns as text since lt has no scientific formatter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| as_gt <- function(x, ...) { | ||
| .Deprecated("lt", package = "lt", | ||
| msg = "as_gt() is deprecated; please use lt::lt() instead.") | ||
| lt::lt(x, ...) |
There was a problem hiding this comment.
As discussed today, this immediate deprecation of as_gt() might break user code if they customize the output with other {gt} related functions. A more gentle deprecation would allow at least one release where as_gt() and lt() are both available, with as_gt() clearly marked with .Deprecated()
There was a problem hiding this comment.
Done in 347ec76. Softened to a gentle deprecation:
- Restored the gt-based
as_gt()S3 methods, soas_gt()still returns agt_tbl— user code that customizes the output with {gt} functions (e.g.tab_options()) keeps working. as_gt()now emits.Deprecated()pointing tolt::lt(), and both are available this release.- Moved {gt} from Imports to Suggests;
as_gt()checks for it at call time and errors with an install hint if missing. - Kept the source lean (dropped the long
@examples, deferred arg docs tolt-methods); thegsd_*helpers stay shared with thelt()methods, so harm-bound support carries over.
Verified: summary(fixed_design_ahr(...)) |> as_gt() warns once and returns a gt_tbl that still accepts gt::tab_options().
Co-authored-by: John Blischak <jdblischak@gmail.com>
Import and re-export lt::lt() so users can call lt() on a design summary after loading only gsDesign2, without also attaching lt or qualifying with lt::. This also makes S3 dispatch robust regardless of package load order, following the r-lib/generics recommendation. See yihui/lt#4. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per PR review, an immediate hard deprecation of as_gt() (redirecting to lt()) would break user code that customizes the output with gt functions, since lt() returns an lt_tbl rather than a gt_tbl. Restore the gt-based as_gt() S3 methods so as_gt() keeps returning a gt_tbl for one release, but mark it deprecated with .Deprecated() pointing to lt::lt(). - Move gt from a hard dependency to Suggests; as_gt() checks for gt at call time and errors with an install hint if it is missing. - Keep the gsd_* helpers shared with the lt() methods (in R/lt.R); the harm-bound support carries over unchanged. - Keep the as_gt.R source lean: drop the long @examples and defer the argument docs to lt-methods. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Summary
gtpackage fromImportsand replace with the lightweightltpackagelt()S3 methods forfixed_design_summaryandgs_design_summary, fully replacingas_gt()lt(),lt_header(),lt_spanner(),lt_format(),lt_footnote(),lt_note(),lt_label())lt_tblassertionsComparison of dependencies
However, since gsDesign depends on gt and gsDesign2 depends on gsDesign, this PR alone won't reduce the number of (recursive) dependencies.
Migration mapping
https://pkg.yihui.org/lt/examples/03-gt
Test plan
as_lt()unit tests pass for fixed and GS designsVignette comparison
This zip archive contains all vignettes and articles built with gt and lt, respectively. You can compare the rendered HTML pages side by side: vignette-compare.zip
Question
Why did we test the LaTeX output of
gt::as_latex()?gsDesign2/tests/testit/helper.R
Line 1 in 7043792