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

Move function to internal #261

Merged
merged 14 commits into from
Jul 18, 2023
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export(expected_accrual)
export(expected_event)
export(expected_time)
export(fixed_design)
export(gridpts)
export(gs_b)
export(gs_create_arm)
export(gs_design_ahr)
Expand All @@ -33,8 +32,6 @@ export(gs_power_rd)
export(gs_power_wlr)
export(gs_spending_bound)
export(gs_spending_combo)
export(h1)
export(hupdate)
export(ppwe)
export(s2pwe)
export(to_integer)
Expand Down
6 changes: 3 additions & 3 deletions R/gridpts_h1_hupdate.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#' }
#' \if{html}{The contents of this section are shown in PDF user manual only.}
#'
#' @export
#' @noRd
#'
#' @examples
#' # Approximate variance of standard normal (i.e., 1)
Expand Down Expand Up @@ -93,7 +93,7 @@ gridpts <- function(r = 18, mu = 0, a = -Inf, b = Inf) {
#' }
#' \if{html}{The contents of this section are shown in PDF user manual only.}
#'
#' @export
#' @noRd
#'
#' @examples
#' # Replicate variance of 1, mean of 35
Expand Down Expand Up @@ -137,7 +137,7 @@ h1 <- function(r = 18, theta = 0, info = 1, a = -Inf, b = Inf) {
#' }
#' \if{html}{The contents of this section are shown in PDF user manual only.}
#'
#' @export
#' @noRd
#'
#' @examples
#' # 2nd analysis with no interim bound and drift 0 should have mean 0, variance 1
Expand Down
41 changes: 9 additions & 32 deletions R/gs_spending_bound.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,40 +80,17 @@
#' @importFrom gsDesign gsDesign sfLDOF
#' @importFrom stats qnorm
#'
#' @export
#'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am a little concerned that if it is okay to delete the examples of gs_spending_bound, considering it is an exported function,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Many refer people to the vignettes?

Or we should create examples without h1() function

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we only show the 1st analysis bound, then we can get rid of h1. Otherwise, if we show the 2nd analysis bound, then we need h1. I personally feel the 2nd analysis is necessary... for the presentation of a comprehensive story.

I am open to referring people to vignettes in @examples, and will defer to @nanxstats for his suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Decision: change the examples in gs_spending_bound as we have in gs_design_ahr.

#' @examples
#' info <- (1:3) * 10
#' info_frac <- info / max(info)
#' k <- length(info_frac)
#'
#' # 1st analysis
#' a1 <- gs_spending_bound(
#' k = 1, efficacy = FALSE, theta = 0,
#' par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = info_frac, param = NULL),
#' hgm1 = NULL
#' )
#'
#' b1 <- gs_spending_bound(
#' k = 1, efficacy = TRUE, theta = 0,
#' par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = info_frac, param = NULL),
#' hgm1 = NULL
#' gs_power_ahr(
#' analysis_time = c(12, 24, 36),
#' event = c(30, 40, 50),
#' binding = TRUE,
#' upper = gs_spending_bound,
#' upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
#' lower = gs_spending_bound,
#' lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL)
#' )
#' cat("The (lower, upper) boundary at the 1st analysis is (", a1, ", ", b1, ").\n")
#'
#' # 2nd analysis
#' a2 <- gs_spending_bound(
#' k = 2, efficacy = FALSE, theta = 0,
#' par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = info_frac, param = NULL),
#' hgm1 = h1(r = 18, theta = 0, info = info[1], a = a1, b = b1)
#' )
#'
#' b2 <- gs_spending_bound(
#' k = 2, efficacy = TRUE, theta = 0,
#' par = list(sf = gsDesign::sfLDOF, total_spend = 0.025, timing = info_frac, param = NULL),
#' hgm1 = h1(r = 18, theta = 0, info = info[1], a = a1, b = b1)
#' )
#' cat("The upper boundary at the 2nd analysis is (", a2, ", ", b2, ").\n")
#' @export
gs_spending_bound <- function(k = 1,
par = list(
sf = gsDesign::sfLDOF,
Expand Down
2 changes: 1 addition & 1 deletion R/utility_tidy_tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ table_ab <- function(table_a, table_b, byvar, decimals = 1, aname = names(table_
# Get order of names to unite table_a columns together with names into a string
col_order <- c(rbind(names(anames), names(table_a)))
# Now unite columns of table_a into a string
astring <- xx %>% tidyr::unite("_alab", col_order, sep = " ")
astring <- xx %>% tidyr::unite("_alab", all_of(col_order), sep = " ")
# Bind this together with the byvar column
astring <- cbind(table_a %>% select(all_of(byvar)), astring)
# Now merge with table_b
Expand Down
3 changes: 0 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ reference:
- expected_accrual
- ppwe
- s2pwe
- gridpts
- h1
- hupdate
- gs_create_arm

articles:
Expand Down
6 changes: 3 additions & 3 deletions inst/old_function/gridpts_h1_hupdate_oldR.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions inst/old_function/gs_power_npe_.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 0 additions & 58 deletions man/gridpts.Rd

This file was deleted.

38 changes: 8 additions & 30 deletions man/gs_spending_bound.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 0 additions & 53 deletions man/h1.Rd

This file was deleted.

Loading