From 69e11884496dda2bf026b47420b954f876cdf274 Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Sun, 15 Mar 2026 02:32:49 +0530 Subject: [PATCH 1/3] Replace deprecated reshape2::melt() with base R and tidyr equivalents --- DESCRIPTION | 1 - NEWS.md | 2 + R/bayesplot-extractors.R | 41 +++++++++++++++---- R/helpers-mcmc.R | 34 ++++++++------- R/helpers-ppc.R | 10 +++-- R/ppc-discrete.R | 4 +- R/ppd-test-statistics.R | 4 +- man/bayesplot-extractors.Rd | 4 +- .../ppd-stat-2d-default.svg | 32 +++++++-------- .../ppd-stat-2d-stat-size-alpha.svg | 32 +++++++-------- .../ppc-test-statistics/ppd-stat-default.svg | 24 +++++------ .../ppd-stat-discrete-stat.svg | 24 +++++------ .../ppd-stat-freqpoly-grouped-default.svg | 22 +++++----- ...d-stat-freqpoly-grouped-stat-facets-bw.svg | 22 +++++----- .../ppd-stat-grouped-default.svg | 24 +++++------ .../ppd-stat-grouped-discrete-stat.svg | 24 +++++------ ...-stat-grouped-stat-facet-args-binwidth.svg | 24 +++++------ .../ppd-stat-stat-binwidth-freq.svg | 24 +++++------ 18 files changed, 191 insertions(+), 161 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f9840ac68..54624ac55 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,7 +36,6 @@ Imports: glue, lifecycle, posterior, - reshape2, rlang (>= 1.0.0), stats, tibble (>= 2.0.0), diff --git a/NEWS.md b/NEWS.md index bf6aaef88..06ca17cfa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # bayesplot (development version) +* Replace deprecated `reshape2::melt()` with base R `as.data.frame.table()` and `tidyr::pivot_longer()` across all internal data-reshaping helpers. `reshape2` has been removed from `Imports`. + * Use `rlang::warn()` and `rlang::inform()` for selected PPC user messages instead of base `warning()` and `message()`. * Standardize input validation errors in `ppc_km_overlay()` and interpolation helpers to use `rlang::abort()` for consistent error handling. * Fix assignment-in-call bug in `mcmc_rank_ecdf()` (#). diff --git a/R/bayesplot-extractors.R b/R/bayesplot-extractors.R index 19c6df882..a9cf18efa 100644 --- a/R/bayesplot-extractors.R +++ b/R/bayesplot-extractors.R @@ -15,12 +15,12 @@ #' @return #' \describe{ #' \item{`log_posterior()`}{ -#' `log_posterior()` methods return a molten data frame (see [reshape2::melt()]). +#' `log_posterior()` methods return a long-format data frame. #' The data frame should have columns `"Iteration"` (integer), `"Chain"` #' (integer), and `"Value"` (numeric). See **Examples**, below. #' } #' \item{`nuts_params()`}{ -#' `nuts_params()` methods return a molten data frame (see [reshape2::melt()]). +#' `nuts_params()` methods return a long-format data frame. #' The data frame should have columns `"Parameter"` (factor), `"Iteration"` #' (integer), `"Chain"` (integer), and `"Value"` (numeric). See **Examples**, below. #' } @@ -85,8 +85,13 @@ log_posterior.stanfit <- function(object, inc_warmup = FALSE, ...) { lp <- rstan::get_logposterior(object, inc_warmup = inc_warmup, ...) - lp <- lapply(lp, as.array) - lp <- set_names(reshape2::melt(lp), c("Iteration", "Value", "Chain")) + lp <- dplyr::bind_rows(lapply(seq_along(lp), function(i) { + data.frame( + Iteration = seq_along(lp[[i]]), + Value = as.numeric(lp[[i]]), + Chain = as.integer(i) + ) + })) validate_df_classes(lp[, c("Chain", "Iteration", "Value")], c("integer", "integer", "numeric")) } @@ -104,7 +109,10 @@ log_posterior.stanreg <- function(object, inc_warmup = FALSE, ...) { #' @method log_posterior CmdStanMCMC log_posterior.CmdStanMCMC <- function(object, inc_warmup = FALSE, ...) { lp <- object$draws("lp__", inc_warmup = inc_warmup) - lp <- reshape2::melt(lp) + lp <- as.data.frame.table(unclass(lp), responseName = "value", + stringsAsFactors = FALSE) + lp[[1]] <- as.integer(lp[[1]]) + lp[[2]] <- as.integer(lp[[2]]) lp$variable <- NULL lp <- dplyr::rename_with(lp, capitalize_first) validate_df_classes(lp[, c("Chain", "Iteration", "Value")], @@ -163,8 +171,19 @@ nuts_params.list <- function(object, pars = NULL, ...) { object <- lapply(object, function(x) x[, pars, drop = FALSE]) } - out <- reshape2::melt(object) - out <- set_names(out, c("Iteration", "Parameter", "Value", "Chain")) + out <- dplyr::bind_rows(lapply(seq_along(object), function(i) { + mat <- object[[i]] + n_iter <- nrow(mat) + par_names <- colnames(mat) + data.frame( + Iteration = rep(seq_len(n_iter), times = length(par_names)), + Parameter = factor(rep(par_names, each = n_iter), levels = par_names), + Value = as.vector(mat), + Chain = as.integer(i), + stringsAsFactors = FALSE + ) + })) + out <- out[c("Iteration", "Parameter", "Value", "Chain")] validate_df_classes(out[, c("Chain", "Iteration", "Parameter", "Value")], c("integer", "integer", "factor", "numeric")) } @@ -177,8 +196,12 @@ nuts_params.CmdStanMCMC <- function(object, pars = NULL, ...) { if (!is.null(pars)) { arr <- arr[,, pars] } - out <- reshape2::melt(arr) - colnames(out)[colnames(out) == "variable"] <- "parameter" + out <- as.data.frame.table(unclass(arr), responseName = "value", + stringsAsFactors = FALSE) + out[[1]] <- as.integer(out[[1]]) + out[[2]] <- as.integer(out[[2]]) + out[[3]] <- factor(out[[3]]) + names(out)[names(out) == "variable"] <- "parameter" out <- dplyr::rename_with(out, capitalize_first) validate_df_classes(out[, c("Chain", "Iteration", "Parameter", "Value")], c("integer", "integer", "factor", "numeric")) diff --git a/R/helpers-mcmc.R b/R/helpers-mcmc.R index 41e2c4ee8..2669f93b9 100644 --- a/R/helpers-mcmc.R +++ b/R/helpers-mcmc.R @@ -120,8 +120,10 @@ select_parameters <- #' #' @noRd #' @param x An mcmc_array (from prepare_mcmc_array). -#' @param varnames,value.name,... Passed to reshape2::melt (array method). -#' @return A molten data frame. +#' @param varnames Character vector of names for the dimension columns. +#' @param value.name Name for the value column. +#' @param ... Unused; kept for backward compatibility. +#' @return A long-format data frame. #' melt_mcmc <- function(x, ...) UseMethod("melt_mcmc") @@ -130,18 +132,16 @@ melt_mcmc.mcmc_array <- function(x, varnames = c("Iteration", "Chain", "Parameter"), value.name = "Value", - as.is = TRUE, ...) { stopifnot(is_mcmc_array(x)) - long <- reshape2::melt( - data = x, - varnames = varnames, - value.name = value.name, - as.is = FALSE, - ...) + long <- as.data.frame.table(x, responseName = value.name, + stringsAsFactors = FALSE) + colnames(long)[seq_along(varnames)] <- varnames - long$Parameter <- factor(long$Parameter) + long[[varnames[1]]] <- as.integer(long[[varnames[1]]]) # Iteration + long[[varnames[2]]] <- as.integer(long[[varnames[2]]]) # Chain + long$Parameter <- factor(long$Parameter) long } @@ -151,14 +151,12 @@ melt_mcmc.matrix <- function(x, varnames = c("Draw", "Parameter"), value.name = "Value", ...) { - long <- reshape2::melt( - data = x, - varnames = varnames, - value.name = value.name, - as.is = FALSE, - ...) - - long$Parameter <- factor(long$Parameter) + long <- as.data.frame.table(x, responseName = value.name, + stringsAsFactors = FALSE) + colnames(long)[seq_along(varnames)] <- varnames + + long[[varnames[1]]] <- as.integer(long[[varnames[1]]]) # Draw + long$Parameter <- factor(long$Parameter) long } diff --git a/R/helpers-ppc.R b/R/helpers-ppc.R index 5206b9afd..998f02a77 100644 --- a/R/helpers-ppc.R +++ b/R/helpers-ppc.R @@ -239,9 +239,13 @@ from_grouped <- function(dots) { #' @noRd melt_predictions <- function(predictions) { obs_names <- attr(predictions, "obs_names") - out <- predictions %>% - reshape2::melt(varnames = c("rep_id", "y_id")) %>% - tibble::as_tibble() + n_reps <- nrow(predictions) + n_obs <- ncol(predictions) + out <- tibble::tibble( + rep_id = rep(seq_len(n_reps), times = n_obs), + y_id = rep(seq_len(n_obs), each = n_reps), + value = as.vector(predictions) + ) rep_labels <- create_rep_ids(out$rep_id) y_names <- obs_names[out$y_id] %||% out$y_id diff --git a/R/ppc-discrete.R b/R/ppc-discrete.R index 2c3f54a96..7b4931873 100644 --- a/R/ppc-discrete.R +++ b/R/ppc-discrete.R @@ -435,8 +435,10 @@ ppc_bars_data <- y = y, yrep = t(yrep) ) + var_levels <- setdiff(colnames(tmp_data), "group") data <- - reshape2::melt(tmp_data, id.vars = "group") %>% + tidyr::pivot_longer(tmp_data, cols = -group, names_to = "variable", values_to = "value") %>% + dplyr::mutate(variable = factor(.data$variable, levels = var_levels)) %>% count(.data$group, .data$value, .data$variable) %>% tidyr::complete(.data$group, .data$value, .data$variable, fill = list(n = 0)) %>% group_by(.data$variable, .data$group) %>% diff --git a/R/ppd-test-statistics.R b/R/ppd-test-statistics.R index d7146405c..c6ba19e71 100644 --- a/R/ppd-test-statistics.R +++ b/R/ppd-test-statistics.R @@ -291,7 +291,9 @@ ppd_stat_data <- function(ypred, group = NULL, stat) { ypred = t(predictions) ) colnames(d) <- gsub(".", "_", colnames(d), fixed = TRUE) - molten_d <- reshape2::melt(d, id.vars = "group") + var_levels <- setdiff(colnames(d), "group") + molten_d <- tidyr::pivot_longer(d, cols = -group, names_to = "variable", values_to = "value") %>% + dplyr::mutate(variable = factor(.data$variable, levels = var_levels)) molten_d <- group_by(molten_d, .data$group, .data$variable) data <- diff --git a/man/bayesplot-extractors.Rd b/man/bayesplot-extractors.Rd index 593a2b0e1..825b0596c 100644 --- a/man/bayesplot-extractors.Rd +++ b/man/bayesplot-extractors.Rd @@ -76,12 +76,12 @@ perform a similar function.} \value{ \describe{ \item{\code{log_posterior()}}{ -\code{log_posterior()} methods return a molten data frame (see \code{\link[reshape2:melt]{reshape2::melt()}}). +\code{log_posterior()} methods return a long-format data frame. The data frame should have columns \code{"Iteration"} (integer), \code{"Chain"} (integer), and \code{"Value"} (numeric). See \strong{Examples}, below. } \item{\code{nuts_params()}}{ -\code{nuts_params()} methods return a molten data frame (see \code{\link[reshape2:melt]{reshape2::melt()}}). +\code{nuts_params()} methods return a long-format data frame. The data frame should have columns \code{"Parameter"} (factor), \code{"Iteration"} (integer), \code{"Chain"} (integer), and \code{"Value"} (numeric). See \strong{Examples}, below. } diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg index 9fdcc654d..1a4bdfb3f 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg @@ -72,23 +72,23 @@ 0.2 mean sd -T -= -( -mean -, - -sd -) +T += +( +mean +, + +sd +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg index 9170f5b97..914f1e9a8 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg @@ -76,23 +76,23 @@ 0.2 median mad -T -= -( -median -, - -mad -) +T += +( +median +, + +mad +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (stat, size, alpha) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg index 16f1016db..a6c039982 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg @@ -56,18 +56,18 @@ 0.1 0.2 0.3 -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg index 4a42b8a79..d87f232be 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg @@ -51,18 +51,18 @@ 0.4 0.5 0.6 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg index 67de54b58..a48bbd943 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg @@ -146,18 +146,18 @@ -T -= -mean +T += +mean -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg index 380125c65..5634658a4 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg @@ -123,18 +123,18 @@ -T -= -sum +T += +sum -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (stat, facets, bw) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg index 3aed9cd74..f885ae2cd 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg @@ -209,18 +209,18 @@ -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg index e075886fe..2741e5eb6 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg @@ -93,18 +93,18 @@ 0.5 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat_grouped (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg index d06ddc1c4..a17f4351a 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg @@ -137,18 +137,18 @@ -T -= -stats::var - -T -( -y -p -r -e -d -) +T += +stats::var + +T +( +y +p +r +e +d +) ppd_stat_grouped (stat, facet_args, binwidth) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg index fbdcef60d..ebbe2d6ef 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg @@ -58,18 +58,18 @@ 1.1 1.2 1.3 -T -= -mad - -T -( -y -p -r -e -d -) +T += +mad + +T +( +y +p +r +e +d +) ppd_stat (stat, binwidth, freq) From 83d103bcfc89d316f0ee7e60a56c38f9ff215cf9 Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Sun, 15 Mar 2026 18:28:00 +0530 Subject: [PATCH 2/3] Accept updated snapshots from reshape2 to tidyr migration --- .../mcmc-diagnostics/mcmc-neff-default.svg | 182 +++++------ .../mcmc-neff-hist-binwidth.svg | 234 +++++++------- .../mcmc-neff-hist-default.svg | 288 +++++++++--------- .../mcmc-neff-missing-levels.svg | 122 ++++---- .../mcmc-nuts/mcmc-nuts-energy-default.svg | 10 +- .../mcmc-nuts/mcmc-nuts-energy-merged.svg | 8 +- 6 files changed, 422 insertions(+), 422 deletions(-) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg index 181537b08..cbf23ff6c 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg @@ -20,106 +20,106 @@ - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg index fc1bfeae5..8c2fe3e63 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg @@ -20,131 +20,131 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (binwidth) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg index 7ae790079..89485ae37 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg @@ -20,158 +20,158 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg index a3a9b2ba7..17467d2c1 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg @@ -20,74 +20,74 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (missing levels) diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg index 45fb70f8d..4d4c3a36e 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg @@ -242,11 +242,11 @@ -π -E -π -Δ -E +π +E +π +Δ +E mcmc_nuts_energy (default) diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg index 26ce37c8f..f7eb3bef3 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg @@ -74,10 +74,10 @@ π -E -π -Δ -E +E +π +Δ +E mcmc_nuts_energy (merged) From ee245930b2226c611541ffc45964eb622d800fbc Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Sun, 15 Mar 2026 19:06:38 +0530 Subject: [PATCH 3/3] Update snapshots for Windows CI environment Accept Windows-specific rendering differences from GitHub Actions CI. --- .../mcmc-diagnostics/mcmc-neff-default.svg | 182 +++++------ .../mcmc-neff-hist-binwidth.svg | 234 +++++++------- .../mcmc-neff-hist-default.svg | 288 +++++++++--------- .../mcmc-neff-missing-levels.svg | 122 ++++---- .../mcmc-nuts/mcmc-nuts-energy-default.svg | 10 +- .../mcmc-nuts/mcmc-nuts-energy-merged.svg | 8 +- .../ppd-stat-2d-default.svg | 32 +- .../ppd-stat-2d-stat-size-alpha.svg | 32 +- .../ppc-test-statistics/ppd-stat-default.svg | 24 +- .../ppd-stat-discrete-stat.svg | 24 +- .../ppd-stat-freqpoly-grouped-default.svg | 22 +- ...d-stat-freqpoly-grouped-stat-facets-bw.svg | 22 +- .../ppd-stat-grouped-default.svg | 24 +- .../ppd-stat-grouped-discrete-stat.svg | 24 +- ...-stat-grouped-stat-facet-args-binwidth.svg | 24 +- .../ppd-stat-stat-binwidth-freq.svg | 24 +- 16 files changed, 548 insertions(+), 548 deletions(-) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg index cbf23ff6c..181537b08 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg @@ -20,106 +20,106 @@ - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg index 8c2fe3e63..fc1bfeae5 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg @@ -20,131 +20,131 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (binwidth) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg index 89485ae37..7ae790079 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg @@ -20,158 +20,158 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg index 17467d2c1..a3a9b2ba7 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg @@ -20,74 +20,74 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (missing levels) diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg index 4d4c3a36e..45fb70f8d 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg @@ -242,11 +242,11 @@ -π -E -π -Δ -E +π +E +π +Δ +E mcmc_nuts_energy (default) diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg index f7eb3bef3..26ce37c8f 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg @@ -74,10 +74,10 @@ π -E -π -Δ -E +E +π +Δ +E mcmc_nuts_energy (merged) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg index 1a4bdfb3f..9fdcc654d 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg @@ -72,23 +72,23 @@ 0.2 mean sd -T -= -( -mean -, - -sd -) +T += +( +mean +, + +sd +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg index 914f1e9a8..9170f5b97 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg @@ -76,23 +76,23 @@ 0.2 median mad -T -= -( -median -, - -mad -) +T += +( +median +, + +mad +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (stat, size, alpha) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg index a6c039982..16f1016db 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg @@ -56,18 +56,18 @@ 0.1 0.2 0.3 -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg index d87f232be..4a42b8a79 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg @@ -51,18 +51,18 @@ 0.4 0.5 0.6 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg index a48bbd943..67de54b58 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg @@ -146,18 +146,18 @@ -T -= -mean +T += +mean -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg index 5634658a4..380125c65 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg @@ -123,18 +123,18 @@ -T -= -sum +T += +sum -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (stat, facets, bw) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg index f885ae2cd..3aed9cd74 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg @@ -209,18 +209,18 @@ -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg index 2741e5eb6..e075886fe 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg @@ -93,18 +93,18 @@ 0.5 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat_grouped (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg index a17f4351a..d06ddc1c4 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg @@ -137,18 +137,18 @@ -T -= -stats::var - -T -( -y -p -r -e -d -) +T += +stats::var + +T +( +y +p +r +e +d +) ppd_stat_grouped (stat, facet_args, binwidth) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg index ebbe2d6ef..fbdcef60d 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg @@ -58,18 +58,18 @@ 1.1 1.2 1.3 -T -= -mad - -T -( -y -p -r -e -d -) +T += +mad + +T +( +y +p +r +e +d +) ppd_stat (stat, binwidth, freq)