From aad1904ee539eefed67e019b8c468f5584aba6c3 Mon Sep 17 00:00:00 2001 From: Alan O'Callaghan Date: Mon, 11 Mar 2024 17:01:40 +0000 Subject: [PATCH] Avoid nsample error --- R/Methods.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/Methods.R b/R/Methods.R index e0e38ef..32215cc 100644 --- a/R/Methods.R +++ b/R/Methods.R @@ -159,6 +159,10 @@ setMethod("Summary", HPD[, 2:3] <- apply(n, 2, function(col) { if (na.rm) { col <- na.omit(col) + # avoid coda error for no samples + if (length(col) < 2) { + return(NA) + } } coda::HPDinterval(coda::mcmc(col), prob = prob) })