Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

263 fixed design split into smaller export function #271

Merged
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ea6b144
`fixed_design` -> `fixed_design_ahr`
LittleBeannie Jul 17, 2023
c0bbcdf
`fixed_design` -> `fixed_design_fh`
LittleBeannie Jul 17, 2023
dc90411
`fixed_design` -> `fixed_design_lf`
LittleBeannie Jul 17, 2023
5766e79
`fixed_design` -> `fixed_design_maxcombo`
LittleBeannie Jul 17, 2023
13e343b
`fixed_design` -> `fixed_design_mb`
LittleBeannie Jul 17, 2023
3f903b6
`fixed_design` -> `fixed_design_milestone`
LittleBeannie Jul 17, 2023
53b6df1
`fixed_design` -> `fixed_design_rd`
LittleBeannie Jul 17, 2023
694395d
`fixed_design` -> `fixed_design_rmst`
LittleBeannie Jul 17, 2023
2b94a6f
delete `fixed_design`
LittleBeannie Jul 17, 2023
d6c61fa
update a warning in `as_gt`
LittleBeannie Jul 17, 2023
232a2ec
update test file
LittleBeannie Jul 17, 2023
43082e0
update vignette
LittleBeannie Jul 17, 2023
785d453
update documentation
LittleBeannie Jul 17, 2023
22e26bd
update pkgdown.ymn
LittleBeannie Jul 17, 2023
e6fc907
fix pkgdown and some lintr issues
LittleBeannie Jul 17, 2023
279d036
fix lintr issue
LittleBeannie Jul 17, 2023
14da125
fix cmd check
LittleBeannie Jul 17, 2023
05d521a
fix pkgdown and lintr issues
LittleBeannie Jul 17, 2023
661cf2e
fix cmd check and lintr issue
LittleBeannie Jul 17, 2023
b99d5d3
lintr
LittleBeannie Jul 17, 2023
e414af8
fix cmd check
LittleBeannie Jul 17, 2023
9d0af24
update documentation
LittleBeannie Jul 17, 2023
9f36b51
lintr issue
LittleBeannie Jul 17, 2023
25d8667
fix warning from cmd check
LittleBeannie Jul 17, 2023
1505dc6
update documentation
LittleBeannie Jul 17, 2023
d3ef23a
address yilong's comments
LittleBeannie Jul 18, 2023
6a4b248
Merge branch 'main' into 263-fixed_design-split-into-smaller-export-f…
LittleBeannie Jul 18, 2023
a4905df
fix cmd check
LittleBeannie Jul 18, 2023
1a76705
update documentation
LittleBeannie Jul 18, 2023
12fd098
typo
LittleBeannie Jul 18, 2023
4b87732
lintr
LittleBeannie Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ export(define_fail_rate)
export(expected_accrual)
export(expected_event)
export(expected_time)
export(fixed_design)
export(fixed_design_ahr)
export(fixed_design_fh)
export(fixed_design_lf)
export(fixed_design_maxcombo)
export(fixed_design_mb)
export(fixed_design_milestone)
export(fixed_design_rd)
export(fixed_design_rmst)
export(gs_b)
export(gs_create_arm)
export(gs_design_ahr)
Expand Down
17 changes: 7 additions & 10 deletions R/as_gt.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ as_gt <- function(x, ...) {
#' # AHR #
#' # ------------------------- #
#' # under fixed power
#' fixed_design(
#' "ahr",
#' fixed_design_ahr(
#' alpha = alpha, power = 1 - beta,
#' enroll_rate = enroll_rate, fail_rate = fail_rate,
#' study_duration = study_duration, ratio = ratio
Expand All @@ -79,8 +78,7 @@ as_gt <- function(x, ...) {
#' # FH #
#' # ------------------------- #
#' # under fixed power
#' fixed_design(
#' "fh",
#' fixed_design_fh(
#' alpha = alpha, power = 1 - beta,
#' enroll_rate = enroll_rate, fail_rate = fail_rate,
#' study_duration = study_duration, ratio = ratio
Expand Down Expand Up @@ -153,14 +151,14 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...) {
"fh" = {
paste0(
"Power for Fleming-Harrington test ",
substr(x$design, 19, nchar(x$design)),
substr(x$Design, 19, nchar(x$Design)),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would we use upper cases now? I thought we should use lower cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out! The x object is from gs_design/power_xxx() |> summary(), so all the column name is capitalized. Sentence case is used for summary output, and as_gt() is just for formate transformation (R table -> gt table). In this way, even if users don't use as_gt, they can use ... |> summary() |> gt() to get a sentence case table without any column renaming.

" using method of Yung and Liu."
)
},
"mb" = {
paste0(
"Power for ",
x$design,
x$Design,
" computed with method of Yung and Liu."
)
},
Expand All @@ -174,20 +172,19 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...) {
"maxcombo" = {
paste0(
"Power for MaxCombo test with Fleming-Harrington tests",
substr(x$design, 9, nchar(x$design)), "."
substr(x$Design, 9, nchar(x$Design)), "."
)
},
"milestone" = {
paste0("Power for ", x$design, " computed with method of Yung and Liu.")
paste0("Power for ", x$Design, " computed with method of Yung and Liu.")
},
"rmst" = {
paste0("Power for ", x$design, " computed with method of Yung and Liu.")
paste0("Power for ", x$Design, " computed with method of Yung and Liu.")
}
)
}

ans <- x %>%
dplyr::mutate(design = design_mtd) %>%
gt::gt() %>%
gt::tab_header(title = title) %>%
gt::tab_footnote(footnote = footnote, locations = gt::cells_title(group = "title"))
Expand Down
Loading
Loading