diff --git a/R/Methods.R b/R/Methods.R index 4e2232e..e0e38ef 100644 --- a/R/Methods.R +++ b/R/Methods.R @@ -156,8 +156,7 @@ setMethod("Summary", dimnames = list(colnames(n), c("median", "lower", "upper")) ) HPD[, 1] <- colMedians(n, na.rm = na.rm) - ind_not_na <- !is.na(HPD[, 1]) - HPD[ind_not_na, 2:3] <- apply(n[, ind_not_na], 2, function(col) { + HPD[, 2:3] <- apply(n, 2, function(col) { if (na.rm) { col <- na.omit(col) } diff --git a/man/Summary-BASiCS_Chain-method.Rd b/man/Summary-BASiCS_Chain-method.Rd index 7954e6c..d71ccc9 100644 --- a/man/Summary-BASiCS_Chain-method.Rd +++ b/man/Summary-BASiCS_Chain-method.Rd @@ -6,7 +6,7 @@ \alias{Summary,BASiCS_Chain-method} \title{'Summary' method for BASiCS_Chain objects} \usage{ -\S4method{Summary}{BASiCS_Chain}(x, prob = 0.95, na.rm = FALSE) +\S4method{Summary}{BASiCS_Chain}(x, ..., prob = 0.95, na.rm = FALSE) } \arguments{ \item{x}{A \code{\linkS4class{BASiCS_Chain}} object.} diff --git a/tests/testthat/test_methods.R b/tests/testthat/test_methods.R index 70ded1c..9d4d8c9 100644 --- a/tests/testthat/test_methods.R +++ b/tests/testthat/test_methods.R @@ -19,6 +19,8 @@ test_that("Summary na.rm", { expect_false(any(is.na(s1@parameters$nu))) expect_true(all(is.na(s2@parameters$nu[1, ]))) expect_true(all(is.na(s2@parameters$nu[4, ]))) + ChainSC@parameters$nu[1, 1:ncol(ChainSC@parameters$nu)] <- NA + expect_error(s3 <- Summary(ChainSC, na.rm = TRUE)) }) test_that("subset", {