Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transition to lifecycle for deprecations #531

Merged
merged 3 commits into from
Mar 25, 2024
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 DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Imports:
ggplot2,
glue (>= 1.3.0),
grDevices,
lifecycle,
magrittr,
methods,
patchwork,
Expand All @@ -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
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
8 changes: 2 additions & 6 deletions R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()")
}
18 changes: 9 additions & 9 deletions R/wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions man/figures/lifecycle-archived.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-defunct.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-experimental.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-maturing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-questioning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-soft-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions man/figures/lifecycle-stable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-superseded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 8 additions & 10 deletions tests/testthat/_snaps/aliases.md
Original file line number Diff line number Diff line change
@@ -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.

6 changes: 4 additions & 2 deletions tests/testthat/_snaps/observe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
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.

---

Code
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.

Loading
Loading