Skip to content

Commit

Permalink
deprecate "adjust" in favor of "p_adjust" (consistency with parameter…
Browse files Browse the repository at this point in the history
…s and correlation)
  • Loading branch information
DominiqueMakowski committed Oct 3, 2022
1 parent 213eff4 commit e947644
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions R/estimate_contrasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#'
#' @inheritParams estimate_means
#' @inheritParams get_emcontrasts
#' @param adjust The p-values adjustment method for frequentist multiple
#' @param p_adjust The p-values adjustment method for frequentist multiple
#' comparisons. Can be one of "holm" (default), "tukey", "hochberg", "hommel",
#' "bonferroni", "BH", "BY", "fdr" or "none". See the p-value adjustment
#' section in the `emmeans::test` documentation.
#' @param adjust Deprecated in favour of `p_adjust`.
#'
#' @inherit estimate_slopes details
#'
Expand Down Expand Up @@ -76,10 +77,17 @@ estimate_contrasts <- function(model,
fixed = NULL,
transform = "none",
ci = 0.95,
adjust = "holm",
p_adjust = "holm",
method = "pairwise",
adjust = NULL,
...) {

# Deprecation
if (!is.null(adjust)) {
warning("The `adjust` argument is deprecated. Please write `p_adjust` instead.", call. = FALSE)
p_adjust <- adjust
}

# Run emmeans
estimated <- get_emcontrasts(model,
contrast = contrast,
Expand All @@ -99,7 +107,7 @@ estimate_contrasts <- function(model,
contrasts <- cbind(estimated@grid, contrasts)
contrasts <- .clean_names_bayesian(contrasts, model, transform, type = "contrast")
} else {
contrasts <- as.data.frame(merge(as.data.frame(estimated), stats::confint(estimated, level = ci, adjust = adjust)))
contrasts <- as.data.frame(merge(as.data.frame(estimated), stats::confint(estimated, level = ci, adjust = p_adjust)))
contrasts <- .clean_names_frequentist(contrasts)
}
contrasts$null <- NULL # introduced in emmeans 1.6.1 (#115)
Expand Down Expand Up @@ -129,7 +137,7 @@ estimate_contrasts <- function(model,
contrasts,
info$contrast,
type = "contrasts",
adjust = adjust
p_adjust = p_adjust
)

# Add attributes
Expand All @@ -140,7 +148,7 @@ estimate_contrasts <- function(model,
attr(contrasts, "at") <- info$at
attr(contrasts, "fixed") <- info$fixed
attr(contrasts, "contrast") <- info$contrast
attr(contrasts, "adjust") <- adjust
attr(contrasts, "p_adjust") <- p_adjust


# Output
Expand Down

0 comments on commit e947644

Please sign in to comment.