Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# bayesplot (development version)

* 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.
* Added vignette sections demonstrating `*_data()` companion functions for building custom ggplot2 visualizations (#435)
Expand Down
3 changes: 3 additions & 0 deletions R/helpers-mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ df_with_chain2array <- function(x) {
#' @param x object to check
#' @return TRUE or FALSE
is_chain_list <- function(x) {
Comment thread
jgabry marked this conversation as resolved.
if (length(x) == 0) {
return(FALSE)
}
check1 <- !is.data.frame(x) && is.list(x)
dims <- try(sapply(x, function(chain) length(dim(chain))), silent=TRUE)
if (inherits(dims, "try-error")) {
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-helpers-mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ test_that("is_chain_list works", {
expect_true(is_chain_list(chainlist))
expect_true(is_chain_list(chainlist1))
expect_true(is_chain_list(chainlist1chain))
expect_false(is_chain_list(list()))
})

test_that("validate_chain_list works", {
Expand Down
Loading