From 139025d32a802cfea49be8472d127bc2d87773e1 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Mon, 25 Mar 2024 09:55:26 -0500 Subject: [PATCH 1/3] allow manually triggering actions workflow --- .github/workflows/check-standard.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index 25166d16..e89eb525 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -5,6 +5,7 @@ on: branches: main pull_request: branches: main + workflow_dispatch: name: R-CMD-check @@ -48,4 +49,4 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: - upload-snapshots: true \ No newline at end of file + upload-snapshots: true From 3c9744bcc40fe759288f82cd411d6b341fc3325c Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Mon, 25 Mar 2024 10:05:12 -0500 Subject: [PATCH 2/3] accept snap change --- tests/testthat/_snaps/visualize/viz-fit-no-h0.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/_snaps/visualize/viz-fit-no-h0.svg b/tests/testthat/_snaps/visualize/viz-fit-no-h0.svg index 4d2ec7e4..c9684f00 100644 --- a/tests/testthat/_snaps/visualize/viz-fit-no-h0.svg +++ b/tests/testthat/_snaps/visualize/viz-fit-no-h0.svg @@ -18,7 +18,7 @@ - + From 7d437a3e6a70ceb12f3d924ad5d91d74459b9d93 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 25 Mar 2024 11:18:01 -0500 Subject: [PATCH 3/3] transition to lifecycle for deprecations (#531) * use lifecycle * hard-deprecate `p_value()` and `conf_int()` * transition `.Deprecated` to `lifecycle::deprecate_warn()` --- DESCRIPTION | 3 +- NEWS.md | 3 ++ R/deprecated.R | 8 ++--- R/wrappers.R | 18 +++++----- man/figures/lifecycle-archived.svg | 21 ++++++++++++ man/figures/lifecycle-defunct.svg | 21 ++++++++++++ man/figures/lifecycle-deprecated.svg | 21 ++++++++++++ man/figures/lifecycle-experimental.svg | 21 ++++++++++++ man/figures/lifecycle-maturing.svg | 21 ++++++++++++ man/figures/lifecycle-questioning.svg | 21 ++++++++++++ man/figures/lifecycle-soft-deprecated.svg | 21 ++++++++++++ man/figures/lifecycle-stable.svg | 29 ++++++++++++++++ man/figures/lifecycle-superseded.svg | 21 ++++++++++++ tests/testthat/_snaps/aliases.md | 18 +++++----- tests/testthat/_snaps/observe.md | 6 ++-- tests/testthat/_snaps/wrappers.md | 42 +++++++++++++++-------- tests/testthat/test-aliases.R | 13 +++---- 17 files changed, 260 insertions(+), 48 deletions(-) create mode 100644 man/figures/lifecycle-archived.svg create mode 100644 man/figures/lifecycle-defunct.svg create mode 100644 man/figures/lifecycle-deprecated.svg create mode 100644 man/figures/lifecycle-experimental.svg create mode 100644 man/figures/lifecycle-maturing.svg create mode 100644 man/figures/lifecycle-questioning.svg create mode 100644 man/figures/lifecycle-soft-deprecated.svg create mode 100644 man/figures/lifecycle-stable.svg create mode 100644 man/figures/lifecycle-superseded.svg diff --git a/DESCRIPTION b/DESCRIPTION index 53ce99ea..aeb0019a 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,6 +42,7 @@ Imports: ggplot2, glue (>= 1.3.0), grDevices, + lifecycle, magrittr, methods, patchwork, @@ -67,5 +68,5 @@ Config/Needs/website: tidyverse/tidytemplate Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 266948af..3030a4e4 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # infer (development version) +* The aliases `p_value()` and `conf_int()`, first deprecated 6 years ago, now + return an error (#530). + # infer v1.0.6 * Updated infrastructure for errors, warnings, and messages (#513). Most of these changes will not be visible to users, though: diff --git a/R/deprecated.R b/R/deprecated.R index 4f8d73f4..3d5a9397 100644 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -17,16 +17,12 @@ NULL #' @export conf_int <- function(x, level = 0.95, type = "percentile", point_estimate = NULL) { - .Deprecated("get_confidence_interval") - get_confidence_interval( - x, level = level, type = type, point_estimate = point_estimate - ) + lifecycle::deprecate_stop("0.4.0", "conf_int()", "get_confidence_interval()") } #' @rdname deprecated #' @export p_value <- function(x, obs_stat, direction) { - .Deprecated("get_p_value") - get_p_value(x = x, obs_stat = obs_stat, direction = direction) + lifecycle::deprecate_stop("0.4.0", "conf_int()", "get_p_value()") } diff --git a/R/wrappers.R b/R/wrappers.R index 87cf32ca..7666b1dc 100755 --- a/R/wrappers.R +++ b/R/wrappers.R @@ -150,10 +150,10 @@ t_stat <- function(x, formula, conf_int = FALSE, conf_level = 0.95, ...) { - .Deprecated( - new = "observe", - msg = c("The t_stat() wrapper has been deprecated in favor of the more " , - "general observe(). Please use that function instead.") + lifecycle::deprecate_warn( + when = "1.0.0", + what = "t_stat()", + with = "observe()" ) check_conf_level(conf_level) @@ -298,11 +298,11 @@ chisq_test <- function(x, formula, response = NULL, #' @export chisq_stat <- function(x, formula, response = NULL, explanatory = NULL, ...) { - .Deprecated( - new = "observe", - msg = c("The chisq_stat() wrapper has been deprecated in favor of the ", - "more general observe(). Please use that function instead.") - ) + lifecycle::deprecate_warn( + when = "1.0.0", + what = "chisq_stat()", + with = "observe()" + ) # Parse response and explanatory variables response <- enquo(response) diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg new file mode 100644 index 00000000..745ab0c7 --- /dev/null +++ b/man/figures/lifecycle-archived.svg @@ -0,0 +1,21 @@ + + lifecycle: archived + + + + + + + + + + + + + + + lifecycle + + archived + + diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..d5c9559e --- /dev/null +++ b/man/figures/lifecycle-defunct.svg @@ -0,0 +1,21 @@ + + lifecycle: defunct + + + + + + + + + + + + + + + lifecycle + + defunct + + diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..b61c57c3 --- /dev/null +++ b/man/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..5d88fc2c --- /dev/null +++ b/man/figures/lifecycle-experimental.svg @@ -0,0 +1,21 @@ + + lifecycle: experimental + + + + + + + + + + + + + + + lifecycle + + experimental + + diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..897370ec --- /dev/null +++ b/man/figures/lifecycle-maturing.svg @@ -0,0 +1,21 @@ + + lifecycle: maturing + + + + + + + + + + + + + + + lifecycle + + maturing + + diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..7c1721d0 --- /dev/null +++ b/man/figures/lifecycle-questioning.svg @@ -0,0 +1,21 @@ + + lifecycle: questioning + + + + + + + + + + + + + + + lifecycle + + questioning + + diff --git a/man/figures/lifecycle-soft-deprecated.svg b/man/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9c166ff3 --- /dev/null +++ b/man/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: soft-deprecated + + + + + + + + + + + + + + + lifecycle + + soft-deprecated + + diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg new file mode 100644 index 00000000..9bf21e76 --- /dev/null +++ b/man/figures/lifecycle-stable.svg @@ -0,0 +1,29 @@ + + lifecycle: stable + + + + + + + + + + + + + + + + lifecycle + + + + stable + + + diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..db8d757f --- /dev/null +++ b/man/figures/lifecycle-superseded.svg @@ -0,0 +1,21 @@ + + lifecycle: superseded + + + + + + + + + + + + + + + lifecycle + + superseded + + diff --git a/tests/testthat/_snaps/aliases.md b/tests/testthat/_snaps/aliases.md index e0ddcca1..91eab8bc 100644 --- a/tests/testthat/_snaps/aliases.md +++ b/tests/testthat/_snaps/aliases.md @@ -1,20 +1,18 @@ -# old aliases produce warning +# old aliases produce informative error Code - res <- gss_calc %>% p_value(obs_stat = -0.2, direction = "right") %>% dplyr::pull() + res <- gss_calc %>% p_value(obs_stat = -0.2, direction = "right") Condition - Warning: - 'p_value' is deprecated. - Use 'get_p_value' instead. - See help("Deprecated") + Error: + ! `conf_int()` was deprecated in infer 0.4.0 and is now defunct. + i Please use `get_p_value()` instead. --- Code res_ <- gss_permute %>% conf_int() Condition - Warning: - 'conf_int' is deprecated. - Use 'get_confidence_interval' instead. - See help("Deprecated") + Error: + ! `conf_int()` was deprecated in infer 0.4.0 and is now defunct. + i Please use `get_confidence_interval()` instead. diff --git a/tests/testthat/_snaps/observe.md b/tests/testthat/_snaps/observe.md index fd0fb34a..7e3b1789 100644 --- a/tests/testthat/_snaps/observe.md +++ b/tests/testthat/_snaps/observe.md @@ -4,7 +4,8 @@ res_wrap <- gss_tbl %>% chisq_stat(college ~ partyid) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -12,5 +13,6 @@ res_wrap_2 <- gss_tbl %>% t_stat(hours ~ sex, order = c("male", "female")) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. diff --git a/tests/testthat/_snaps/wrappers.md b/tests/testthat/_snaps/wrappers.md index 132e551f..bccf6b77 100644 --- a/tests/testthat/_snaps/wrappers.md +++ b/tests/testthat/_snaps/wrappers.md @@ -36,7 +36,8 @@ res_ <- gss_tbl %>% chisq_stat(college ~ partyid) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -44,7 +45,8 @@ obs_stat_way <- gss_tbl %>% chisq_stat(college ~ partyid) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -52,7 +54,8 @@ obs_stat_way <- gss_tbl %>% chisq_stat(partyid ~ NULL) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -60,7 +63,8 @@ obs_stat_way_alt <- gss_tbl %>% chisq_stat(response = partyid) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -68,7 +72,8 @@ res_ <- gss_tbl %>% t_stat(hours ~ sex, order = c("male", "female")) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -76,7 +81,8 @@ obs_stat_way <- gss_tbl %>% t_stat(hours ~ sex, order = c("male", "female")) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -85,7 +91,8 @@ order = c("male", "female")) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -93,7 +100,8 @@ res_ <- gss_tbl %>% t_stat(hours ~ NULL) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -101,7 +109,8 @@ obs_stat_way <- gss_tbl %>% t_stat(hours ~ NULL) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -109,7 +118,8 @@ obs_stat_way_alt <- gss_tbl %>% t_stat(response = hours) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -117,7 +127,8 @@ res_ <- chisq_stat(x = gss_tbl, response = age, explanatory = sex) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. Error in `chisq_stat()`: ! The response variable of `age` is not appropriate since the response variable is expected to be categorical. @@ -127,7 +138,8 @@ res_ <- chisq_stat(x = gss_tbl, response = sex, explanatory = age) Condition Warning: - The chisq_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `chisq_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. Error in `chisq_stat()`: ! The explanatory variable of `age` is not appropriate since the response variable is expected to be categorical. @@ -147,7 +159,8 @@ "male")) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. --- @@ -156,7 +169,8 @@ var.equal = TRUE) Condition Warning: - The t_stat() wrapper has been deprecated in favor of the more general observe(). Please use that function instead. + `t_stat()` was deprecated in infer 1.0.0. + i Please use `observe()` instead. # two sample prop_test works diff --git a/tests/testthat/test-aliases.R b/tests/testthat/test-aliases.R index d6c7b094..516aa5a6 100644 --- a/tests/testthat/test-aliases.R +++ b/tests/testthat/test-aliases.R @@ -10,14 +10,15 @@ test_that("aliases work", { expect_silent(gss_permute %>% get_ci()) }) -test_that("old aliases produce warning", { +test_that("old aliases produce informative error", { expect_snapshot( + error = TRUE, res <- gss_calc %>% - p_value(obs_stat = -0.2, direction = "right") %>% - dplyr::pull() + p_value(obs_stat = -0.2, direction = "right") ) - expect_equal(res, 1) - - expect_snapshot(res_ <- gss_permute %>% conf_int()) + expect_snapshot( + error = TRUE, + res_ <- gss_permute %>% conf_int() + ) })