Print full spending function parameters in print.gsSurv (#307) - #342
Merged
Merged
Conversation
print.gsSurv() extracted the spending-function description from summary() by splitting on bare periods. Spending functions with decimal parameters (e.g. the t-distribution's a = -1.63774) were truncated at the first period, printing "a = -1." instead of all parameters. Split on sentence boundaries (period followed by whitespace) instead, so decimals are preserved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Fixes #307.
print.gsSurv()truncated spending-function parameters that contain decimal values. For the t-distribution spending function (sfTDist, "3 Parameters" in the Shiny app), the output showed onlya = -1.instead of the fulla = -1.63774, b = 2.96683, df = 3.Root cause
print.gsSurv()builds the "Spending functions:" block by extracting sentences fromsummary(x)viastrsplit(summ_text, "\\.")— a split on bare periods. Decimal parameter values (-1.63774) contain periods, so the split shredded the number and the surviving fragment was the truncated...a = -1.print.gsDesign()(the binomial path) uses different code and was unaffected, which is why the bug only appeared for time-to-event designs.Fix
Split on sentence boundaries (a period followed by whitespace,
(?<=\\.)\\s+) rather than bare periods, so decimals inside parameter values are preserved. A trailing period is stripped and re-added for consistent formatting.Verification
Before:
After:
test-developer-test-print-gsSurv-tdist-307.R.independent-test-print.gsSurvsnapshot: the old snapshot itself encoded the bug (rho = 0.for asfPowerdesign withsflpar = .5); it now correctly readsrho = 0.5.print.gsSurvtests pass; non-decimal spending functions (HSDgamma = -4, LDOF) unchanged.🤖 Generated with Claude Code