Skip to content

Commit a1db377

Browse files
authoredMar 7, 2025
Merge pull request #7 from Bayer-Group/dev
fixed compare_to_control_fisher
2 parents 8a063a7 + 8913c51 commit a1db377

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed
 

‎R/quantal.R

+4-2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ many_to_one_fisher_test <- function(xtab, ref.group = NULL, p.adjust.method = "h
165165
#' @param control_level The level to use as control (default: first level in the data)
166166
#' @param alternative Direction of the alternative hypothesis ("two.sided", "less", or "greater")
167167
#' @param conf.level Confidence level for the returned confidence interval
168+
#' @param p.adjust.method p-value adjustment method, passing to the stats function.
168169
#'
169170
#' @return A data frame with factor levels and corresponding p-values
170171
#' @export
@@ -188,7 +189,8 @@ many_to_one_fisher_test <- function(xtab, ref.group = NULL, p.adjust.method = "h
188189
compare_to_control_fisher <- function(data, factor_col, success_col, failure_col,
189190
control_level = NULL,
190191
alternative = "two.sided",
191-
conf.level = 0.95) {
192+
conf.level = 0.95,
193+
p.adjust.method = "holm") {
192194

193195
# Validate inputs
194196
if (!all(c(factor_col, success_col, failure_col) %in% colnames(data))) {
@@ -256,7 +258,7 @@ compare_to_control_fisher <- function(data, factor_col, success_col, failure_col
256258
}
257259

258260
# Add adjusted p-values
259-
fisher_results$p_adjusted <- p.adjust(fisher_results$p_value, method = "holm")
261+
fisher_results$p_adjusted <- p.adjust(fisher_results$p_value, method = p.adjust.method)
260262

261263
# Rename the level column to match the input factor column name
262264
names(fisher_results)[names(fisher_results) == "level"] <- factor_col

‎man/compare_to_control_fisher.Rd

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vignettes/articles/Quantal-Data.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Note that just two groups also work.
5454
```{r}
5555
# Run the function
5656
result <- compare_to_control_fisher(test_data, "treatment", "survived", "died",
57-
control_level = "control",p.adjust.methods="holm")
57+
control_level = "control",p.adjust.method="holm")
5858
result
5959
ctab <- create_contingency_table(test_data,"treatment", "survived", "died")
6060
drcHelper::many_to_one_fisher_test(ctab,ref.group = "treatment_control",p.adjust.method = "holm")

0 commit comments

Comments
 (0)