Skip to content

Commit 70996a9

Browse files
Merge branch 'main' into 441-info-frac-driven-design-does-not-work-for-gs_design_wlr
2 parents 1185d9f + f965dae commit 70996a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+514
-771
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: gsDesign2
22
Title: Group Sequential Design with Non-Constant Effect
3-
Version: 1.1.2.22
3+
Version: 1.1.2.23
44
Authors@R: c(
55
person("Keaven", "Anderson", email = "keaven_anderson@merck.com", role = c("aut")),
66
person("Yilong", "Zhang", email = "elong0527@gmail.com", role = c("aut")),

NAMESPACE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
S3method(as_gt,fixed_design)
44
S3method(as_gt,gs_design)
5+
S3method(as_gt,simtrial_gs_wlr)
56
S3method(as_rtf,fixed_design)
67
S3method(as_rtf,gs_design)
78
S3method(summary,fixed_design)
@@ -75,17 +76,17 @@ importFrom(dplyr,left_join)
7576
importFrom(dplyr,mutate)
7677
importFrom(dplyr,one_of)
7778
importFrom(dplyr,rename)
79+
importFrom(dplyr,row_number)
7880
importFrom(dplyr,select)
7981
importFrom(dplyr,summarize)
8082
importFrom(dplyr,ungroup)
8183
importFrom(gsDesign,gsDesign)
8284
importFrom(gsDesign,sfLDOF)
83-
importFrom(mvtnorm,GenzBretz)
8485
importFrom(stats,pnorm)
8586
importFrom(stats,qnorm)
87+
importFrom(stats,setNames)
8688
importFrom(stats,stepfun)
8789
importFrom(stats,uniroot)
88-
importFrom(survival,Surv)
8990
importFrom(tibble,tibble)
9091
importFrom(utils,tail)
9192
useDynLib(gsDesign2, .registration = TRUE)

R/ahr.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
#' }
7373
#' \if{html}{The contents of this section are shown in PDF user manual only.}
7474
#'
75-
#' @importFrom data.table setDF setDT
76-
#'
7775
#' @export
7876
#'
7977
#' @examples

R/ahr_blinded.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
#' }
6161
#' \if{html}{The contents of this section are shown in PDF user manual only.}
6262
#'
63-
#' @importFrom tibble tibble
64-
#' @importFrom survival Surv
65-
#'
6663
#' @export
6764
#'
6865
#' @examples
@@ -91,7 +88,7 @@ ahr_blinded <- function(
9188
stop("'intervals' must be a vector of positive numbers.")
9289
}
9390
if (length(intervals) != length(hr)) {
94-
stop("the piecewise model specified 'hr' and 'intervals' differ in length.")
91+
stop("The piecewise model specified 'hr' and 'intervals' differ in length.")
9592
}
9693

9794
# Set final element of "intervals" to Inf

R/as_gt.R

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...) {
8989
return(ans)
9090
}
9191

92+
get_method <- function(x, methods) intersect(methods, class(x))[1]
93+
9294
# get the fixed design method
9395
fd_method <- function(x) {
94-
methods <- c("ahr", "fh", "mb", "lf", "rd", "maxcombo", "milestone", "rmst")
95-
intersect(methods, class(x))[1]
96+
get_method(x, c("ahr", "fh", "mb", "lf", "rd", "maxcombo", "milestone", "rmst"))
9697
}
9798

9899
# get the default title
@@ -251,17 +252,16 @@ as_gt.gs_design <- function(
251252
...) {
252253

253254
x_old <- x
254-
full_alpha <- attr(x, "full_alpha")
255255
parts <- gsd_parts(
256256
x, title, subtitle, colname_spannersub, footnote,
257257
display_bound, display_columns, display_inf_bound
258258
)
259259

260260
x <- parts$x %>%
261-
dplyr::group_by(Analysis) %>%
261+
group_by(Analysis) %>%
262262
gt::gt() %>%
263263
gt::tab_spanner(
264-
columns = dplyr::all_of(colname_spannersub),
264+
columns = all_of(colname_spannersub),
265265
label = colname_spanner
266266
) %>%
267267
gt::tab_header(title = parts$title, subtitle = parts$subtitle)
@@ -288,7 +288,7 @@ as_gt.gs_design <- function(
288288
}
289289

290290
# add footnote for non-binding design
291-
footnote_nb <- gsd_footnote_nb(x_old, parts$alpha, full_alpha)
291+
footnote_nb <- gsd_footnote_nb(x_old, parts$alpha)
292292
if (!is.null(footnote_nb)) x <- gt::tab_footnote(
293293
x,
294294
footnote = footnote_nb,
@@ -348,7 +348,8 @@ gsd_footnote <- function(method, columns) {
348348
}
349349

350350
# footnote for non-binding designs
351-
gsd_footnote_nb <- function(x, x_alpha, full_alpha) {
351+
gsd_footnote_nb <- function(x, x_alpha) {
352+
full_alpha <- attr(x, "full_alpha")
352353
if (!inherits(x, "non_binding") || x_alpha >= full_alpha) return()
353354
a1 <- format(x_alpha, scientific = FALSE)
354355
a2 <- format(full_alpha, scientific = FALSE)
@@ -408,9 +409,17 @@ gsd_parts <- function(
408409
)
409410

410411
list(
411-
x = dplyr::arrange(x2, Analysis),
412+
x = arrange(x2, Analysis),
412413
title = title, subtitle = subtitle,
413414
footnote = footnote %||% gsd_footnote(method, columns),
414415
alpha = max(filter(x, Bound == bound[1])[[alpha_column]])
415416
)
416417
}
418+
419+
# Only purpose of the method below is to fix S3 redirection when gsDesign2 is
420+
# loaded after simtrial, which masks the as_gt() generic from simtrial
421+
422+
#' @export
423+
as_gt.simtrial_gs_wlr <- function(x, ...) {
424+
simtrial:::as_gt.simtrial_gs_wlr(x, ...)
425+
}

R/as_rtf.R

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ check_rel_width <- function(width, n_col) {
171171
#' @param display_columns A vector of strings specifying the variables to be
172172
#' displayed in the summary table.
173173
#' @param display_inf_bound Logical, whether to display the +/-inf bound.
174-
#' @param full_alpha The full alpha used in the design, the default is 0.025.
175-
# If the cumulative alpha for final analysis is less than the `full_alpha`
176-
#' when the futility bound is non-binding, a footnote will be displayed, saying
177-
#' the smaller value subtracts the probability of crossing a futility bound before
178-
#' crossing an efficacy bound at a later analysis under the null hypothesis.
179174
#' @inheritParams r2rtf::rtf_page
180175
#' @inheritParams r2rtf::rtf_body
181176
#' @param file File path for the output.
@@ -283,7 +278,6 @@ as_rtf.gs_design <- function(
283278
display_bound = c("Efficacy", "Futility"),
284279
display_columns = NULL,
285280
display_inf_bound = TRUE,
286-
full_alpha = 0.025,
287281
col_rel_width = NULL,
288282
orientation = c("portrait", "landscape"),
289283
text_font_size = 9,
@@ -368,7 +362,7 @@ as_rtf.gs_design <- function(
368362
}
369363

370364
# add footnote for non-binding design
371-
footnote_nb <- gsd_footnote_nb(x_old, parts$alpha, full_alpha)
365+
footnote_nb <- gsd_footnote_nb(x_old, parts$alpha)
372366
if (!is.null(footnote_nb)) {
373367
mkr <- marker()
374368
i <- gsd_footnote_row(x, display_bound[1])

R/check_arg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ check_enroll_rate_fail_rate <- function(enroll_rate, fail_rate) {
255255
if ("stratum" %in% colnames(enroll_rate) && "stratum" %in% colnames(fail_rate)) {
256256
strata_enroll <- unique(enroll_rate$stratum)
257257
strata_fail <- unique(fail_rate$stratum)
258-
strata_common <- dplyr::intersect(strata_enroll, strata_fail)
258+
strata_common <- intersect(strata_enroll, strata_fail)
259259

260260
if (sum(strata_common %in% strata_enroll) != length(strata_enroll)) {
261261
stop("The `Strata` column in the input argument `enroll_rate` and `fail_rate` must be the same!")

R/define.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ define_enroll_rate <- function(
5454
duration,
5555
rate,
5656
stratum = "All") {
57-
df <- tibble::tibble(
57+
df <- tibble(
5858
stratum = stratum,
5959
duration = duration,
6060
rate = rate
@@ -117,7 +117,7 @@ define_fail_rate <- function(
117117
dropout_rate,
118118
hr = 1,
119119
stratum = "All") {
120-
df <- tibble::tibble(
120+
df <- tibble(
121121
stratum = stratum,
122122
duration = duration,
123123
fail_rate = fail_rate,

R/expected_accural.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
#' }
4545
#' \if{html}{The contents of this section are shown in PDF user manual only.}
4646
#'
47-
#' @importFrom dplyr filter lead
48-
#' @importFrom tibble tibble
49-
#' @importFrom stats stepfun
50-
#'
5147
#' @export
5248
#'
5349
#' @examples

R/expected_time.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#' }
4646
#' }
4747
#'
48-
#' @importFrom stats uniroot
49-
#'
5048
#' @export
5149
#'
5250
#' @examples

0 commit comments

Comments
 (0)