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. 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)) {