Add Mantel-Fleiss criterion function mantel_fleiss_crit(). - #1513
Add Mantel-Fleiss criterion function mantel_fleiss_crit().#1513wwojciech wants to merge 9 commits into
Conversation
|
@danielinteractive - I was wondering whether I should introduce an Do you think having an |
danielinteractive
left a comment
There was a problem hiding this comment.
Thanks @wwojciech , please see few comments below - otherwise looks nice.
I don't think we need na.rm argument when the other functions which are used together with this don't have it.
|
@danielinteractive - I am now thinking that it would probably be better to change the UI to Most (if not all) of the |
|
@wwojciech yeah starting from the table is probably a good idea |
|
Thank you @danielinteractive for your review. I’ve updated the code to address all of your suggestions and changed the UI as discussed. Please review the PR again when you have a chance. Thanks! |
|
@danielinteractive - do you think this below little helper should go to #' @param rsp (`logical`)\cr
#' A logical vector indicating whether each observation is a responder.
#' @param grp (`factor`)\cr
#' A factor assigning observations to one of two groups (e.g., reference
#' and treatment). It must have exactly two levels.
#' @param strata (`factor`)\cr
#' Factor defining the stratification variable. Each unique
#' stratum defines a separate 2 x 2 contingency table.
safe_2x2_strat_table <- function(rsp, grp, strata) {
checkmate::assert_logical(rsp, any.missing = FALSE)
checkmate::assert_factor(grp, len = length(rsp), any.missing = FALSE, n.levels = 2)
checkmate::assert_factor(strata, len = length(rsp), any.missing = FALSE)
# Make rsp a factor to handle cases with only TRUE or only FALSE.
rsp <- factor(rsp, levels = c("TRUE", "FALSE"))
table(grp, rsp, strata)
} |
|
Thanks @wwojciech yeah to |
Fixes #1512