Skip to content

Commit

Permalink
Make deprecated functions noisier/defunct (#6389)
Browse files Browse the repository at this point in the history
* Defunct `funs()`
* Defunct `bench_tbl()` and friends
* Defunct `location()` + `changes()`
* Deprecate tidyselect wrappers
* Deprecate `progress_estimated()`
* Make all old deprecations always warn
* Remove `all_equal()` from index

Fixes #6387
  • Loading branch information
hadley authored Aug 16, 2022
1 parent 7c28098 commit 925685a
Show file tree
Hide file tree
Showing 36 changed files with 326 additions and 708 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Depends:
Imports:
generics,
glue (>= 1.3.2),
lifecycle (>= 1.0.1),
lifecycle (>= 1.0.1.9000),
magrittr (>= 1.5),
methods,
R6,
rlang (>= 1.0.4),
tibble (>= 2.1.3),
tidyselect (>= 1.1.2.9000),
utils,
vctrs (>= 0.4.1.9000),
vctrs (>= 0.4.1.9000),
pillar (>= 1.5.1)
Suggests:
bench,
Expand All @@ -64,9 +64,10 @@ Suggests:
testthat (>= 3.1.1),
tidyr,
withr
Remotes:
Remotes:
r-lib/tidyselect,
r-lib/vctrs
r-lib/vctrs,
r-lib/lifecycle
VignetteBuilder:
knitr
Encoding: UTF-8
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ S3method(print,any_vars)
S3method(print,dplyr_join_by)
S3method(print,dplyr_sel_vars)
S3method(print,fun_list)
S3method(print,location)
S3method(print,src)
S3method(pull,data.frame)
S3method(rbind,grouped_df)
Expand Down
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# dplyr (development version)

* `progress_estimate()` is deprecated for all uses (#6387).

* `funs()`, deprecated in 0.8.0, is now defunct (#6387).

* `select_vars()`, `rename_vars()`, `select_var()` and `current_var()`,
deprecated in 0.8.4, are now defunct (#6387).

* `bench_tbls()`, `compare_tbls()`, `compare_tbls2()`, `eval_tbls()`, and
`eval_tbl()`, deprecated in 1.0.0, are now defunct (#6387).

* `location()` and `changes()`, deprecated in 1.0.0, are now defunct (#6387).

* All other functions deprecated in 1.0.0 and earlier now warn every time you
use them (#6387). They are likely to be made defunct in the next major
version (but not before mid 2024).

* `nth()`, `first()`, and `last()` have gained an `na_rm` argument since they
are summary functions (#6242, with contributions from @tnederlof).

Expand Down
1 change: 1 addition & 0 deletions R/colwise-funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ as_fun_list <- function(.funs, .env, ..., .caller, .caller_arg = "...", error_ca
lifecycle::deprecate_warn(
"0.8.3", what,
details = "Please use a one-sided formula, a function, or a function name.",
always = TRUE,
env = .env
)
.x <- new_formula(NULL, quo_squash(.x), quo_get_env(.x))
Expand Down
4 changes: 2 additions & 2 deletions R/count-tally.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ add_count <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .drop = depr
#' @export
add_count.default <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .drop = deprecated()) {
if (!missing(.drop)) {
lifecycle::deprecate_warn("1.0.0", "add_count(.drop = )")
lifecycle::deprecate_warn("1.0.0", "add_count(.drop = )", always = TRUE)
}

if (!missing(...)) {
Expand All @@ -127,7 +127,7 @@ add_count.default <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .dro
#' @export
add_count.data.frame <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .drop = deprecated()) {
if (!missing(.drop)) {
lifecycle::deprecate_warn("1.0.0", "add_count(.drop = )")
lifecycle::deprecate_warn("1.0.0", "add_count(.drop = )", always = TRUE)
}

if (!missing(...)) {
Expand Down
103 changes: 101 additions & 2 deletions R/defunct.r
Original file line number Diff line number Diff line change
@@ -1,21 +1,120 @@
#' Defunct functions
#'
#' `r lifecycle::badge("deprecated")`
#' @description
#' `r lifecycle::badge("defunct")`
#'
#' Executing these functions will tell you which function replaces them.
#' These functions were deprecated for at least two years before being
#' made defunct. If there's a known replacement, calling the function
#' will tell you about it.
#'
#' @keywords internal
#' @name defunct
NULL

#' @usage # Deprecated in 0.5.0 -------------------------------------
#' @name defunct
NULL

#' @export
#' @rdname defunct
id <- function(.variables, drop = FALSE) {
lifecycle::deprecate_stop("0.5.0", "id()", "vctrs::vec_group_id()")
}

#' @usage # Deprecated in 0.7.0 -------------------------------------
#' @name defunct
NULL

#' @export
#' @rdname defunct
failwith <- function(default = NULL, f, quiet = FALSE) {
lifecycle::deprecate_stop("0.7.0", "failwith()", "purrr::possibly()")
}

#' @usage # Deprecated in 0.8.* -------------------------------------
#' @name defunct
NULL

#' @export
#' @rdname defunct
funs <- function(..., .args = list()) {
lifecycle::deprecate_stop("0.8.0", "funs()", details = paste_line(
"Please use a list of either functions or lambdas: ",
"",
" # Simple named list: ",
" list(mean = mean, median = median)",
"",
" # Auto named with `tibble::lst()`: ",
" tibble::lst(mean, median)",
"",
" # Using lambdas",
" list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))"
))
}

#' @export
#' @rdname defunct
select_vars <- function(vars = chr(), ..., include = chr(), exclude = chr()) {
lifecycle::deprecate_stop("0.8.4", "select_vars()", "tidyselect::vars_select()")
}
#' @export
#' @rdname defunct
rename_vars <- function(vars = chr(), ..., strict = TRUE) {
lifecycle::deprecate_stop("0.8.4", "rename_vars()", "tidyselect::vars_rename()")
}
#' @export
#' @rdname defunct
select_var <- function(vars, var = -1) {
lifecycle::deprecate_stop("0.8.4", "select_var()", "tidyselect::vars_pull()")
}
#' @export
#' @rdname defunct
current_vars <- function(...) {
lifecycle::deprecate_stop("0.8.4", "current_vars()", "tidyselect::peek_vars()")
}

#' @usage # Deprecated in 1.0.0 -------------------------------------
#' @name defunct
NULL

#' @export
#' @rdname defunct
bench_tbls <- function(tbls, op, ..., times = 10) {
lifecycle::deprecate_stop("1.0.0", "bench_tbls()")
}

#' @export
#' @rdname defunct
compare_tbls <- function(tbls, op, ref = NULL, compare = equal_data_frame, ...) {
lifecycle::deprecate_stop("1.0.0", "compare_tbls()")
}

#' @export
#' @rdname defunct
compare_tbls2 <- function(tbls_x, tbls_y, op, ref = NULL, compare = equal_data_frame, ...) {
lifecycle::deprecate_stop("1.0.0", "compare_tbls2()")
}

#' @export
#' @rdname defunct
eval_tbls <- function(tbls, op) {
lifecycle::deprecate_stop("1.0.0", "eval_tbls()")
}

#' @export
#' @rdname defunct
eval_tbls2 <- function(tbls_x, tbls_y, op) {
lifecycle::deprecate_stop("1.0.0", "eval_tbls2()")
}

#' @export
#' @rdname defunct
location <- function(df) {
lifecycle::deprecate_stop("1.0.0", "location()", "lobstr::ref()")
}

#' @export
#' @rdname defunct
changes <- function(x, y) {
lifecycle::deprecate_stop("1.0.0", "changes()", "lobstr::ref()")
}
112 changes: 0 additions & 112 deletions R/deprec-bench-compare.r

This file was deleted.

2 changes: 1 addition & 1 deletion R/deprec-combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' # ->
#' vctrs::vec_c(!!!list(f1, f2))
combine <- function(...) {
lifecycle::deprecate_warn("1.0.0", "combine()", "vctrs::vec_c()")
lifecycle::deprecate_warn("1.0.0", "combine()", "vctrs::vec_c()", always = TRUE)

args <- list2(...)
if (length(args) == 1 && is.list(args[[1]])) {
Expand Down
9 changes: 6 additions & 3 deletions R/deprec-dbi.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ src_mysql <- function(dbname, host = NULL, port = 0L, username = "root",
check_installed("RMySQL", "to connect to MySQL/MariaDB.")
lifecycle::deprecate_warn(
"1.0.0", "dplyr::src_mysql()",
details = "Please use `tbl()` directly with a database connection"
details = "Please use `tbl()` directly with a database connection",
always = TRUE
)

con <- DBI::dbConnect(
Expand All @@ -65,7 +66,8 @@ src_postgres <- function(dbname = NULL, host = NULL, port = NULL,
check_installed("RPostgreSQL", "to connect to PostgreSQL.")
lifecycle::deprecate_warn(
"1.0.0", "dplyr::src_postgres()",
details = "Please use `tbl()` directly with a database connection"
details = "Please use `tbl()` directly with a database connection",
always = TRUE
)

in_travis <- identical(Sys.getenv("TRAVIS"), "true")
Expand Down Expand Up @@ -97,7 +99,8 @@ src_sqlite <- function(path, create = FALSE) {
check_dbplyr()
lifecycle::deprecate_warn(
"1.0.0", "dplyr::src_sqlite()",
details = "Please use `tbl()` directly with a database connection"
details = "Please use `tbl()` directly with a database connection",
always = TRUE
)

if (!create && !file.exists(path)) {
Expand Down
5 changes: 1 addition & 4 deletions R/deprec-do.r
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ do.grouped_df <- function(.data, ...) {

out <- replicate(m, vector("list", n), simplify = FALSE)
names(out) <- names(args)
p <- rlang::with_options(
lifecycle_verbosity = "quiet",
progress_estimated(n * m, min_time = 2)
)
p <- Progress$new(n * m, min_time = 2)

for (`_i` in seq_len(n)) {
for (j in seq_len(m)) {
Expand Down
Loading

0 comments on commit 925685a

Please sign in to comment.