diff --git a/NEWS.md b/NEWS.md index 588ae62b..b99a0846 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,6 +32,7 @@ can be set to FALSE to recover the old version of the plot. (#171, #235, @ecoronado92) +* Fix error in `mcmc_acf()` for some input types. (#244, #245, @hhau) # bayesplot 1.7.2 diff --git a/R/mcmc-diagnostics.R b/R/mcmc-diagnostics.R index 32db0b64..d2c65560 100644 --- a/R/mcmc-diagnostics.R +++ b/R/mcmc-diagnostics.R @@ -580,8 +580,7 @@ acf_data <- function(x, lags) { abort(paste0("Too few iterations for lags=", lags, ".")) } - data <- reshape2::melt(x, value.name = "Value") - data$Chain <- factor(data$Chain) + data <- melt_mcmc(x) ac_list <- tapply( data[["Value"]], # INDEX = list(data[["Chain"]], data[["Parameter"]]),