Skip to content

Commit

Permalink
add input checking of all(hr == 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleBeannie committed Jan 3, 2024
1 parent 9ef6050 commit b850326
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/gs_design_ahr.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ gs_design_ahr <- function(
if ((length(analysis_time) > 1) && (length(info_frac) > 1) && (length(info_frac) != length(analysis_time))) {
stop("gs_design_ahr() info_frac and analysis_time must have the same length if both have length > 1.")
}
if(all(fail_rate$hr == 1)){

Check warning on line 239 in R/gs_design_ahr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_ahr.R,line=239,col=5,[spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.

Check warning on line 239 in R/gs_design_ahr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_ahr.R,line=239,col=29,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 239 in R/gs_design_ahr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_ahr.R,line=239,col=29,[paren_body_linter] There should be a space between a right parenthesis and a body expression.
stop("gs_design_ahr() hr must not be equal to 1 throughout the study as this is the null hypothesis.")
}

# --------------------------------------------- #
# check if alpha is same as alpha spending #
Expand Down
4 changes: 4 additions & 0 deletions R/gs_design_combo.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ gs_design_combo <- function(
two_sided <- TRUE
}

if(all(fail_rate$hr == 1)){

Check warning on line 181 in R/gs_design_combo.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_combo.R,line=181,col=5,[spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.

Check warning on line 181 in R/gs_design_combo.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_combo.R,line=181,col=29,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 181 in R/gs_design_combo.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_combo.R,line=181,col=29,[paren_body_linter] There should be a space between a right parenthesis and a body expression.
stop("gs_design_combo() hr must not be equal to 1 throughout the study as this is the null hypothesis.")
}

# Information Fraction
if (n_analysis == 1) {
min_info_frac <- 1
Expand Down
3 changes: 3 additions & 0 deletions R/gs_design_wlr.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ gs_design_wlr <- function(
if (max(info_frac) != 1) stop(msg)
msg <- "gs_design_wlr(): info_frac and analysis_time must have the same length if both have length > 1"
if ((length(analysis_time) > 1) && (length(info_frac) > 1) && (length(info_frac) != length(analysis_time))) stop(msg)
if(all(fail_rate$hr == 1)){

Check warning on line 155 in R/gs_design_wlr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_wlr.R,line=155,col=5,[spaces_left_parentheses_linter] Place a space before left parenthesis, except in a function call.

Check warning on line 155 in R/gs_design_wlr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_wlr.R,line=155,col=29,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 155 in R/gs_design_wlr.R

View workflow job for this annotation

GitHub Actions / lint

file=R/gs_design_wlr.R,line=155,col=29,[paren_body_linter] There should be a space between a right parenthesis and a body expression.
stop("gs_design_wlr() hr must not be equal to 1 throughout the study as this is the null hypothesis.")
}
# get the info_scale
info_scale <- match.arg(info_scale)

Expand Down

0 comments on commit b850326

Please sign in to comment.