Skip to content

Commit 3739678

Browse files
committed
delete the variable n_analysis
1 parent 1439e2d commit 3739678

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

R/gs_info_ahr.R

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,22 @@ gs_info_ahr <- function(enroll_rate = define_enroll_rate(duration = c(2, 2, 10),
9696
check_fail_rate(fail_rate)
9797
check_enroll_rate_fail_rate(enroll_rate, fail_rate)
9898

99-
# at least one of `analysis_time` or `event` should be provided
100-
if (is.null(analysis_time) && is.null(event)) {
101-
stop("gs_info_ahr(): One of `event` and `analysis_time`
102-
must be a numeric value or vector with increasing values")
103-
}
104-
105-
# get the number of analyses
106-
n_analysis <- 0
10799
if (!is.null(analysis_time)) {
108100
check_analysis_time(analysis_time)
109-
n_analysis <- length(analysis_time)
110101
}
111102

112103
if (!is.null(event)) {
113104
check_event(event)
114-
if (n_analysis == 0) {
115-
n_analysis <- length(event)
116-
} else if (n_analysis != length(event)) {
117-
stop("gs_info_ahr(): If both event and analysis_time
118-
specified, must have same length")
119-
}
105+
}
106+
107+
# at least one of `analysis_time` or `event` should be provided
108+
if (is.null(analysis_time) && is.null(event)) {
109+
stop("gs_info_ahr(): One of `event` and `analysis_time`
110+
must be a numeric value or vector with increasing values")
111+
}
112+
# if both `analysis_time` and `event` are provided, check they are of same length
113+
if (!is.null(analysis_time) && !is.null(event)) {
114+
stop("gs_info_ahr(): If both event and analysis_time specified, must have same length")
120115
}
121116

122117
# -------------------------- #

0 commit comments

Comments
 (0)