Skip to content

Replace gt dependency with lt#629

Draft
yihui wants to merge 5 commits into
mainfrom
replace-gt-with-lt
Draft

Replace gt dependency with lt#629
yihui wants to merge 5 commits into
mainfrom
replace-gt-with-lt

Conversation

@yihui
Copy link
Copy Markdown
Collaborator

@yihui yihui commented May 21, 2026

Summary

  • Remove the gt package from Imports and replace with the lightweight lt package
  • New as_lt() generic + S3 methods for fixed_design_summary and gs_design_summary, fully replacing as_gt()
  • All 14 vignettes updated to use lt functions (lt(), lt_header(), lt_spanner(), lt_format(), lt_footnote(), lt_note(), lt_cols_label())
  • README.Rmd updated to use knitr::kable() for GitHub rendering and show lt API in code examples
  • Tests updated for lt_tbl assertions

New lt features required (committed in yihui/lt)

  • lt_cols_label(): rename column display headers without modifying data frame columns
  • lt_footnote(match = "starts_with"): target all row groups whose label starts with a prefix (used for "Analysis: ..." groups)

Migration mapping

gt lt
gt::gt(x) lt(x)
group_by(col) |> gt() lt(x, row_group = "col")
tab_header(title, subtitle) lt_header(title, subtitle)
tab_spanner(label, columns) lt_spanner(label, columns)
fmt_number(columns, decimals) lt_format(columns, decimals)
tab_footnote(fn, cells_column_labels(col)) lt_footnote(text, "column", columns)
tab_footnote(fn) (no location) lt_note(text)
cols_label(a = "A") lt_cols_label(a = "A")

Test plan

  • as_lt() unit tests pass for fixed and GS designs
  • All design types render correctly (fixed_ahr, gs_ahr, gs_wlr, gs_rd)
  • Visual comparison with gt output confirms structural equivalence
  • Non-binding design body footnote renders correctly
  • Custom footnotes (colname, title, analysis, spanner) all work
  • R CMD check passes
  • All vignettes build without error

🤖 Generated with Claude Code

yihui and others added 4 commits May 21, 2026 14:05
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 <[email protected]>
lt requires character strings for column names (unlike gt's tidy-select).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@yihui yihui marked this pull request as draft May 21, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant