Skip to content

Commit 9375b16

Browse files
committed
the alpha_column argument should just be hard-coded to "Null hypothesis" instead of taking the value colname_spannersub[2]
1 parent 5837440 commit 9375b16

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

R/as_gt.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ gsd_footnote_row <- function(x, bound) {
379379
# a list of information for `as_[gt|rtf].gs_design()` methods: the transformed
380380
# data, title, and footnote, etc.
381381
gsd_parts <- function(
382-
x, title, subtitle, spannersub, footnote, bound, columns, inf_bound,
383-
alpha_column = spannersub[2], transform = identity
382+
x, title, subtitle, spannersub, footnote, bound, columns, inf_bound,
383+
transform = identity
384384
) {
385385
method <- intersect(c("ahr", "wlr", "combo", "rd"), class(x))[1]
386386
if (!inf_bound) x <- filter(x, !is.infinite(Z))
@@ -412,7 +412,7 @@ gsd_parts <- function(
412412
x = arrange(x2, Analysis),
413413
title = title, subtitle = subtitle,
414414
footnote = footnote %||% gsd_footnote(method, columns),
415-
alpha = max(filter(x, Bound == bound[1])[[alpha_column]])
415+
alpha = max(filter(x, Bound == bound[1])[["Null hypothesis"]])
416416
)
417417
}
418418

R/as_rtf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ as_rtf.gs_design <- function(
288288

289289
parts <- gsd_parts(
290290
x, title, subtitle, colname_spannersub, footnote,
291-
display_bound, display_columns, display_inf_bound, "Null hypothesis",
291+
display_bound, display_columns, display_inf_bound,
292292
function(x) {
293293
x2 <- data.frame(lapply(x, function(x) trimws(formatC(x, flag = "-"), "r")))
294294
names(x2) <- names(x)

tests/testthat/_snaps/independent_as_gt.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,13 @@
338338
\multicolumn{6}{l}{Analysis: 3 Time: 24.5 N: 108 Events: 50 AHR: 0.71 Information fraction: 1\textsuperscript{\textit{3}}} \\[2.5pt]
339339
\midrule\addlinespace[2.5pt]
340340
Futility & -0.22 & 0.5881 & 1.0650 & 0.1002 & 0.4319 \\
341-
Efficacy & 2.03 & 0.0212 & 0.5631 & 0.2071 & 0.0250\textsuperscript{\textit{4}} \\
341+
Efficacy & 2.03 & 0.0212 & 0.5631 & 0.2071 & 0.0250 \\
342342
\bottomrule
343343
\end{tabular*}
344344
\begin{minipage}{\linewidth}
345345
\textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\
346346
\textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\
347347
\textsuperscript{\textit{3}}wAHR is the weighted AHR.\\
348-
\textsuperscript{\textit{4}}Cumulative alpha for final analysis (-Inf) is less than the full alpha (0.025) when the futility bound is non-binding. The smaller value subtracts the probability of crossing a futility bound before crossing an efficacy bound at a later analysis (0.025 - Inf = -Inf) under the null hypothesis.\\
349348
\end{minipage}
350349
\end{table}
351350

tests/testthat/test-independent_as_gt.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ test_that("Snapshot test for gs_power_wlr summary as_gt with colname_spanner and
231231
as_gt(
232232
colname_spanner = "Cumulative probability to cross boundaries",
233233
colname_spannersub = c("under H1", "under H0")
234-
) %>%
235-
suppressWarnings() # Can be removed after <https://github.com/Merck/gsDesign2/issues/339> is fixed
234+
)
236235

237236
local_edition(3)
238237
expect_snapshot_output(gt_to_latex(output))

0 commit comments

Comments
 (0)