From 0058fd4a95f0cbf5638390a9b4702313fb22b50f Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Mon, 6 Apr 2026 18:35:16 +0530 Subject: [PATCH 1/2] replace apply() with storage.mode() for integer to numeric matrix conversion --- R/helpers-ppc.R | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/R/helpers-ppc.R b/R/helpers-ppc.R index 5206b9af..618b9fca 100644 --- a/R/helpers-ppc.R +++ b/R/helpers-ppc.R @@ -73,12 +73,7 @@ validate_predictions <- function(predictions, n_obs = NULL) { } if (is.integer(predictions)) { - if (nrow(predictions) == 1) { - predictions[1, ] <- as.numeric(predictions[1,, drop = FALSE]) - } - else { - predictions <- apply(predictions, 2, as.numeric) - } + storage.mode(predictions) <- "numeric" } if (anyNA(predictions)) { From 989cce16e2052fa45888532b8949ad637da9952f Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Mon, 6 Apr 2026 18:43:15 +0530 Subject: [PATCH 2/2] update news.md --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index af643760..c8f7d131 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # bayesplot (development version) +* Replace `apply()` with `storage.mode()` for integer-to-numeric matrix conversion in `validate_predictions()`. * Fixed `is_chain_list()` to correctly reject empty lists instead of silently returning `TRUE`. * Added unit tests for `mcmc_areas_ridges_data()`, `mcmc_parcoord_data()`, and `mcmc_trace_data()`. * Added unit tests for `ppc_error_data()` and `ppc_loo_pit_data()` covering output structure, argument handling, and edge cases.