Replace gt with lt for summary tables (#371) - #372
Merged
Conversation
Replace the heavy gt dependency with the lightweight lt package for
rendering simulation summary tables.
- Add lt to Imports; keep gt in Suggests for the deprecated as_gt().
- Add R/lt.R: re-export the lt() generic and port
as_gt.simtrial_gs_wlr() to lt.simtrial_gs_wlr(). lt has no tidyselect,
so spanner/label columns are enumerated explicitly and moved into
contiguous blocks with lt_move().
- Deprecate as_gt(): the generic now emits .Deprecated("lt", ...) and the
simtrial_gs_wlr method guards with assert_gt_installed(). It still
returns a gt_tbl for one release.
- Convert all vignettes gt -> lt.
- pkgdown: reference lt.simtrial_gs_wlr; NEWS: add major-changes entry.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The raw output of sim_gs_n() carries the "simtrial_gs_wlr" class but lacks the attributes added by summary(). Since the re-exported lt() generic now dispatches to lt.simtrial_gs_wlr(), guard the method: when the object is not a summary (no compare_with_design attribute), fall back to a plain lt table, mirroring how bare gt() rendered it before. Fixes the vignette build failure in CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Regenerate man pages so links to lt() and lt-methods resolve to the local topics instead of gsDesign. The initial roxygen run predated the lt re-export being loaded, so it mis-resolved [lt-methods] to gsDesign:lt-methods, tripping the "error on warning" R CMD check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yihui
commented
Sep 2, 2026
yihui
marked this pull request as ready for review
September 2, 2026 21:35
jdblischak
reviewed
Sep 3, 2026
Collaborator
Co-authored-by: John Blischak <jdblischak@gmail.com>
The two summary tables in this vignette were previously commented out. Convert them from gt to lt and uncomment. gt::fmt_number(columns = everything()) had no direct lt equivalent (lt lacks tidyselect), so select the numeric columns explicitly with names(fr)[sapply(fr, is.numeric)]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s like 'senario', 'period', 'duration' are integers and shouldn't have 2 decimal places)
lt matches each spanner to the visual position of its first column, then
spans the next length(columns) columns. The spanner columns were listed in
grep() (original-name) order, e.g. c("sim_time", "asy_time"), but lt_move()
lays them out asymptotic-before-simulated, e.g. c("asy_time", "sim_time").
The mismatched first column shifted every spanner's colspan, cascading
until the last spanner ("Probability of crossing efficacy bounds under H1")
had no column to anchor to and was silently dropped from the rendered table.
List each spanner's columns in the same paired asy-before-sim order that
lt_move() uses, reusing shared vectors so the move layout and the spanner
selections cannot drift apart. Verified (via a node-baked render) that the
one-sided table now shows Time/N/Events/Efficacy and the two-sided table
additionally shows Futility.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 tasks
Collaborator
Author
That was a bug in {lt} and has been fixed. For now, I'm using a workaround, which can be simplified after the next {lt} release (#373). |
jdblischak
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary
Replaces the heavy gt dependency with the lightweight lt package for rendering simulation summary tables, mirroring gsDesign2 PR #629 and gsDesign PR #282. Closes #371.
ltto Imports; keepgtin Suggests (still used by the deprecatedas_gt()).R/lt.R(new): re-export thelt()generic solt()dispatches after loading only simtrial; portas_gt.simtrial_gs_wlr()tolt.simtrial_gs_wlr(). Since lt has no tidyselect, spanner/label columns are enumerated explicitly (grep()), and paired asymptotic/simulated columns are moved into contiguous blocks withlt_move()before applyinglt_spanner(). Two-branch logic (compare_with_design) and the two-sided extra spanner are preserved.R/as_gt.R:as_gt()generic now emits.Deprecated("lt", ...);as_gt.simtrial_gs_wlr()guards withassert_gt_installed(). Still returns agt_tblfor one release.as_gt.fixed_design/as_gt.gs_designredirection shims left as-is.gt→ltcalls; droppedlibrary(lt)where only the re-exportedlt()is used (rmst); switchedrequireNamespace("gt")gates tolt.lt.simtrial_gs_wlralongsideas_gt.simtrial_gs_wlr.Verification
R CMD INSTALL+ smoke test: afterlibrary(simtrial)alone,summary(...) |> lt()returns anlt_tblfor all three branches (no-design, one-sided, two-sided);as_gt()warns once and returns agt_tbl.gt::/library(gt)outside the intentionally-kept deprecatedas_gt()internals and doc references.Known issue (pre-existing, not from this PR)
The
test-unvalidated-sim_gs_n.R/test-unvalidated-summary.Rparallel tests error withcould not find function "convert_list_to_df_w_list_cols"/create_cutinside doFuture workers. This reproduces on the base branch and is a parallel-backend globals-detection issue, unrelated to the gt→lt change. Left for follow-up.Follow-up
After merge, file an issue (like gsDesign2#663) to fully remove gt and
as_gt()in a future release.🤖 Generated with Claude Code