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
3 changes: 2 additions & 1 deletion R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#' @param nas A flag specifying whether to also fill missing values.
#' @param parameters A character vector (or NULL) of the parameters to subset by.
#' @param iterations An integer vector (or NULL) of the iterations to subset by.
#' @param simplify A flag specifying whether to drop sd and zscore columns.
#' @param simplify A flag specifying whether to drop the sd and zscore
#' columns. `simplify = FALSE` is deprecated.
#' @param directional_information A flag specifying whether the svalue column
#' should be calculated using [extras::directional_information()] instead of
#' [extras::svalue()].
Expand Down
6 changes: 3 additions & 3 deletions R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ warn_default_directional_information <- function(
#' @export
tidy.mcmc <- function(
x,
simplify = FALSE,
simplify = TRUE,
directional_information = FALSE,
...
) {
Expand All @@ -43,7 +43,7 @@ tidy.mcmc <- function(
#' @export
tidy.mcmc.list <- function(
x,
simplify = FALSE,
simplify = TRUE,
directional_information = FALSE,
...
) {
Expand Down Expand Up @@ -73,7 +73,7 @@ tidy.mcmc.list <- function(
#' ), simplify = TRUE, directional_information = TRUE)
tidy.nlists <- function(
x,
simplify = FALSE,
simplify = TRUE,
directional_information = FALSE,
...
) {
Expand Down
3 changes: 2 additions & 1 deletion man/params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/tidy.mcmc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/tidy.mcmc.list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/tidy.nlists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 24 additions & 7 deletions tests/testthat/test-tidy.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
test_that("tidy.nlists", {
rlang::local_options(lifecycle_verbosity = "quiet")

lifecycle::expect_deprecated(tidy(nlists(), directional_information = FALSE))
lifecycle::expect_deprecated(
tidy(nlists(), simplify = FALSE, directional_information = FALSE)
)

expect_identical(
tidy(nlists()),
tidy(nlists(), simplify = FALSE),
structure(
list(
term = structure(
Expand All @@ -30,7 +32,7 @@ test_that("tidy.nlists", {
)
)
expect_equal(
tidy(nlists(nlist())),
tidy(nlists(nlist()), simplify = FALSE),
tibble::tibble(
term = term(x = 0),
estimate = numeric(0),
Expand All @@ -42,7 +44,7 @@ test_that("tidy.nlists", {
)
)
expect_identical(
tidy(nlists(nlist(x = 2))),
tidy(nlists(nlist(x = 2)), simplify = FALSE),
tibble::tibble(
term = term("x"),
estimate = 2,
Expand All @@ -54,7 +56,7 @@ test_that("tidy.nlists", {
)
)
expect_identical(
tidy(nlists(nlist(x = 2:4))),
tidy(nlists(nlist(x = 2:4)), simplify = FALSE),
tibble::tibble(
term = term(x = 3),
estimate = c(2, 3, 4),
Expand All @@ -74,7 +76,7 @@ test_that("tidy.nlists", {
)
)
expect_identical(
tidy(nlists(nlist(y = 1, s = 1:2))),
tidy(nlists(nlist(y = 1, s = 1:2)), simplify = FALSE),
tibble::tibble(
term = term("y", s = 2),
estimate = c(1, 1, 2),
Expand All @@ -94,7 +96,10 @@ test_that("tidy.nlists", {
)
)
expect_equal(
tidy(nlists(nlist(x = 1, y = 1:2), nlist(x = 1, y = 3:4))),
tidy(
nlists(nlist(x = 1, y = 1:2), nlist(x = 1, y = 3:4)),
simplify = FALSE
),
tibble::tibble(
term = term("x" = 1, y = 2),
estimate = c(1, 2, 3),
Expand All @@ -115,6 +120,18 @@ test_that("tidy.nlists", {
)
})

test_that("tidy.nlists default is simplify = TRUE", {
rlang::local_options(lifecycle_verbosity = "quiet")
expect_identical(
tidy(nlists(nlist(x = 2))),
tidy(nlists(nlist(x = 2)), simplify = TRUE, directional_information = FALSE)
)
expect_identical(
colnames(tidy(nlists(nlist(x = 2)))),
c("term", "estimate", "lower", "upper", "svalue")
)
})

test_that("tidy.nlists", {
expect_identical(
tidy(nlists(), simplify = TRUE, directional_information = FALSE),
Expand Down
Loading