From 32cc3bf2cbe3b38656c939eb90db8047aae61f03 Mon Sep 17 00:00:00 2001 From: James Azam Date: Thu, 12 Dec 2024 19:06:23 +0000 Subject: [PATCH] Improve check for max in `plot.dist_spec` (#896) * Improve check for max in dist_spec * Add NEWs item --- NEWS.md | 1 + R/dist_spec.R | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 02e92f75f..d8edd70b6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,7 @@ - A bug was fixed where the initial growth was never estimated (i.e. the prior mean was always zero). By @sbfnk in #853 and reviewed by @seabbs. - A bug was fixed where an internal function for applying a default cdf cutoff failed due to a difference a vector length issue. By @jamesmbaazam in #858 and reviewed by @sbfnk. - All parameters have been changed to the new parameter interface. By @sbfnk in #871 and reviewed by @seabbs. +- A bug was fixed where `plot.dist_spec()` wasn't throwing an informative error due to an incomplete check for the max of the specified delay. By @jamesmbaazam in #858 and reviewed by @. ## Package changes diff --git a/R/dist_spec.R b/R/dist_spec.R index 37d368362..5b9a155ba 100644 --- a/R/dist_spec.R +++ b/R/dist_spec.R @@ -718,7 +718,7 @@ plot.dist_spec <- function(x, samples = 50L, res = 1, cumulative = TRUE, ...) { cdf_cutoff <- 0 } pmf_dt <- lapply(dists, function(y) { - if (is.infinite(attr(y, "max"))) { + if (is.infinite(max(y))) { cli_abort( c( "!" = "All distributions in {.var x} must have a finite