From 8a8fdd3e237292ba104a11cb5076eed3a416e38a Mon Sep 17 00:00:00 2001 From: Tony Stone Date: Mon, 6 Mar 2023 14:50:52 +0000 Subject: [PATCH] Update mcmc-intervals.R Setting `prob <- FALSE` does not raise an error but has unintended consequences. --- R/mcmc-intervals.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/mcmc-intervals.R b/R/mcmc-intervals.R index a12c6fa8..57fd740d 100644 --- a/R/mcmc-intervals.R +++ b/R/mcmc-intervals.R @@ -864,6 +864,8 @@ compute_interval_density <- function(x, interval_width = 1, n_dens = 1024, } check_interval_widths <- function(prob, prob_outer) { + if (!(is.numeric(prob) && is.numeric(prob_outer))) + abort("`prob` and `prob_outer` must be numeric") if (prob < 0 || prob > 1 || prob_outer < 0 || prob_outer > 1) abort("`prob` and `prob_outer` must be in [0,1].") if (prob_outer < prob) {