Skip to content

Commit

Permalink
Update describe_posterior.R
Browse files Browse the repository at this point in the history
  • Loading branch information
mattansb committed Jan 27, 2025
1 parent fb746e3 commit 46139ea
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion R/describe_posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe_posterior.default <- function(posterior, ...) {
}

# we need this information from the original object
if (all(rope_range == "default")) {
if (.check_if_need_to_compute_rope_range(rope_range, test)) {
rope_range <- rope_range(x, verbose = verbose, ...)
}

Expand Down Expand Up @@ -1433,3 +1433,20 @@ describe_posterior.BFBayesFactor <- function(posterior,
"bf", "bayesfactor", "bayes_factor", "p_map", "all"
), several.ok = TRUE)
}

#' @keywords internal
.check_if_need_to_compute_rope_range <- function(rope_range, test) {
if (rope_range != "default") {
return(FALSE)
}

need_rope <- c(
"all",
"p_rope",
"ps", "p_sig", "p_significance",
"rope",
"equivalence", "equivalence_test", "equitest"
)

return(is.character(test) && length(test) > 0L && any(need_rope %in% tolower(test)))

Check warning on line 1451 in R/describe_posterior.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/describe_posterior.R,line=1451,col=3,[return_linter] Use implicit return behavior; explicit return() is not needed.
}

Check warning on line 1452 in R/describe_posterior.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/describe_posterior.R,line=1452,col=2,[trailing_blank_lines_linter] Add a terminal newline.

0 comments on commit 46139ea

Please sign in to comment.