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

Failure fix for M1mac and noLD - long double problems for sum(weights) #981

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion R/control_incidence_rate.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' for confidence interval type.
#' @param input_time_unit (`string`)\cr `day`, `week`, `month`, or `year` (default)
#' indicating time unit for data input.
#' @param num_pt_year (`numeric`)\cr number of patient-years to use when calculating AE rate.
#' @param num_pt_year (`numeric`)\cr number of patient-years to use when calculating `AE` rate.
#' @param time_unit_input `r lifecycle::badge("deprecated")` Please use the `input_time_unit` argument instead.
#' @param time_unit_output `r lifecycle::badge("deprecated")` Please use the `num_pt_year` argument instead.
#'
Expand Down
7 changes: 4 additions & 3 deletions R/estimate_proportion.R
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ prop_strat_wilson <- function(rsp,
assert_proportion_value(conf_level)

tbl <- table(rsp, strata)
n_strata <- ncol(tbl)
n_strata <- length(unique(strata))

# Checking the weights and maximum number of iterations.
do_iter <- FALSE
Expand All @@ -289,8 +289,9 @@ prop_strat_wilson <- function(rsp,
if (is.null(max_iterations)) max_iterations <- 10
checkmate::assert_int(max_iterations, na.ok = FALSE, null.ok = FALSE, lower = 1)
}
checkmate::assert_numeric(weights, lower = 0, upper = 1, any.missing = FALSE, len = ncol(tbl))
checkmate::assert_int(sum(weights), lower = 1, upper = 1)
checkmate::assert_numeric(weights, lower = 0, upper = 1, any.missing = FALSE, len = n_strata)
sum_weights <- checkmate::assert_int(sum(weights))
if (as.integer(sum_weights + 0.5) != 1L) stop("Sum of weights must be 1L.")


xs <- tbl["TRUE", ]
Expand Down
2 changes: 1 addition & 1 deletion man/control_incidence_rate.Rd

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