From 266710e9f2f38911e4edee38450b07e4dc6f3269 Mon Sep 17 00:00:00 2001 From: Joe Thorley Date: Wed, 15 Jul 2026 10:43:09 -0700 Subject: [PATCH] Change tidy() default to simplify = TRUE The default value of simplify in tidy.nlists(), tidy.mcmc() and tidy.mcmc.list() is now TRUE, so default calls return the term, estimate, lower, upper and svalue columns without a deprecation warning. Explicit simplify = FALSE still returns the sd and zscore columns but remains warn-deprecated, matching the migration already completed for coef() in mcmcr 0.4.1 and embr 1.1.0. Co-Authored-By: Claude Fable 5 --- R/params.R | 3 ++- R/tidy.R | 6 +++--- man/params.Rd | 3 ++- man/tidy.mcmc.Rd | 5 +++-- man/tidy.mcmc.list.Rd | 5 +++-- man/tidy.nlists.Rd | 5 +++-- tests/testthat/test-tidy.R | 31 ++++++++++++++++++++++++------- 7 files changed, 40 insertions(+), 18 deletions(-) diff --git a/R/params.R b/R/params.R index 1b0f64ff..d4deb7f3 100644 --- a/R/params.R +++ b/R/params.R @@ -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()]. diff --git a/R/tidy.R b/R/tidy.R index fc9cfa13..f025ec33 100644 --- a/R/tidy.R +++ b/R/tidy.R @@ -22,7 +22,7 @@ warn_default_directional_information <- function( #' @export tidy.mcmc <- function( x, - simplify = FALSE, + simplify = TRUE, directional_information = FALSE, ... ) { @@ -43,7 +43,7 @@ tidy.mcmc <- function( #' @export tidy.mcmc.list <- function( x, - simplify = FALSE, + simplify = TRUE, directional_information = FALSE, ... ) { @@ -73,7 +73,7 @@ tidy.mcmc.list <- function( #' ), simplify = TRUE, directional_information = TRUE) tidy.nlists <- function( x, - simplify = FALSE, + simplify = TRUE, directional_information = FALSE, ... ) { diff --git a/man/params.Rd b/man/params.Rd index 6b8ef817..510ed76e 100644 --- a/man/params.Rd +++ b/man/params.Rd @@ -35,7 +35,8 @@ for each term element.} \item{iterations}{An integer vector (or NULL) of the iterations to subset by.} -\item{simplify}{A flag specifying whether to drop sd and zscore columns.} +\item{simplify}{A flag specifying whether to drop the sd and zscore +columns. \code{simplify = FALSE} is deprecated.} \item{directional_information}{A flag specifying whether the svalue column should be calculated using \code{\link[extras:directional_information]{extras::directional_information()}} instead of diff --git a/man/tidy.mcmc.Rd b/man/tidy.mcmc.Rd index 125869df..bfd9382f 100644 --- a/man/tidy.mcmc.Rd +++ b/man/tidy.mcmc.Rd @@ -4,12 +4,13 @@ \alias{tidy.mcmc} \title{Turn an object into a tidy tibble} \usage{ -\method{tidy}{mcmc}(x, simplify = FALSE, directional_information = FALSE, ...) +\method{tidy}{mcmc}(x, simplify = TRUE, directional_information = FALSE, ...) } \arguments{ \item{x}{An object.} -\item{simplify}{A flag specifying whether to drop sd and zscore columns.} +\item{simplify}{A flag specifying whether to drop the sd and zscore +columns. \code{simplify = FALSE} is deprecated.} \item{directional_information}{A flag specifying whether the svalue column should be calculated using \code{\link[extras:directional_information]{extras::directional_information()}} instead of diff --git a/man/tidy.mcmc.list.Rd b/man/tidy.mcmc.list.Rd index 673cba29..1ae48e3d 100644 --- a/man/tidy.mcmc.list.Rd +++ b/man/tidy.mcmc.list.Rd @@ -4,12 +4,13 @@ \alias{tidy.mcmc.list} \title{Turn an object into a tidy tibble} \usage{ -\method{tidy}{mcmc.list}(x, simplify = FALSE, directional_information = FALSE, ...) +\method{tidy}{mcmc.list}(x, simplify = TRUE, directional_information = FALSE, ...) } \arguments{ \item{x}{An object.} -\item{simplify}{A flag specifying whether to drop sd and zscore columns.} +\item{simplify}{A flag specifying whether to drop the sd and zscore +columns. \code{simplify = FALSE} is deprecated.} \item{directional_information}{A flag specifying whether the svalue column should be calculated using \code{\link[extras:directional_information]{extras::directional_information()}} instead of diff --git a/man/tidy.nlists.Rd b/man/tidy.nlists.Rd index ef2b90a8..2d906319 100644 --- a/man/tidy.nlists.Rd +++ b/man/tidy.nlists.Rd @@ -4,12 +4,13 @@ \alias{tidy.nlists} \title{Turn an object into a tidy tibble} \usage{ -\method{tidy}{nlists}(x, simplify = FALSE, directional_information = FALSE, ...) +\method{tidy}{nlists}(x, simplify = TRUE, directional_information = FALSE, ...) } \arguments{ \item{x}{An object.} -\item{simplify}{A flag specifying whether to drop sd and zscore columns.} +\item{simplify}{A flag specifying whether to drop the sd and zscore +columns. \code{simplify = FALSE} is deprecated.} \item{directional_information}{A flag specifying whether the svalue column should be calculated using \code{\link[extras:directional_information]{extras::directional_information()}} instead of diff --git a/tests/testthat/test-tidy.R b/tests/testthat/test-tidy.R index 880d3b92..dce2d5ef 100644 --- a/tests/testthat/test-tidy.R +++ b/tests/testthat/test-tidy.R @@ -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( @@ -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), @@ -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, @@ -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), @@ -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), @@ -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), @@ -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),