Skip to content

Commit 70f1e1a

Browse files
authored
Update deprecations (#1432)
Fixes #1406
1 parent fd6d2bb commit 70f1e1a

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# tidyr (development version)
22

3+
* All functions deprecated in tidyr 1.0 and 1.2 (the old lazyeval functions
4+
ending in `_` and various arguments to `unnest()`) now warn on every use.
5+
They will be made defunct in 2024 (#1406).
6+
37
* `pivot_wider()` is now faster when `names_sep` is provided (@mgirlich, #1426).
48

59
* The `...` argument of both `pivot_longer()` and `pivot_wider()` has been

R/dep-lazyeval.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ NULL
2929
#' @inheritParams complete
3030
#' @export
3131
complete_ <- function(data, cols, fill = list(), ...) {
32-
lifecycle::deprecate_warn("1.0.0", "complete_()", "complete()")
32+
lifecycle::deprecate_warn("1.0.0", "complete_()", "complete()", always = TRUE)
3333
UseMethod("complete_")
3434
}
3535
#' @export
@@ -41,7 +41,7 @@ complete_.data.frame <- function(data, cols, fill = list(), ...) {
4141
#' @rdname deprecated-se
4242
#' @export
4343
drop_na_ <- function(data, vars) {
44-
lifecycle::deprecate_warn("1.0.0", "drop_na_()", "drop_na()")
44+
lifecycle::deprecate_warn("1.0.0", "drop_na_()", "drop_na()", always = TRUE)
4545
UseMethod("drop_na_")
4646
}
4747
#' @export
@@ -53,7 +53,7 @@ drop_na_.data.frame <- function(data, vars) {
5353
#' @param expand_cols Character vector of column names to be expanded.
5454
#' @export
5555
expand_ <- function(data, dots, ...) {
56-
lifecycle::deprecate_warn("1.0.0", "expand_()", "expand()")
56+
lifecycle::deprecate_warn("1.0.0", "expand_()", "expand()", always = TRUE)
5757
UseMethod("expand_")
5858
}
5959
#' @export
@@ -65,14 +65,14 @@ expand_.data.frame <- function(data, dots, ...) {
6565
#' @param x For `nesting_` and `crossing_` a list of variables.
6666
#' @export
6767
crossing_ <- function(x) {
68-
lifecycle::deprecate_warn("1.0.0", "crossing_()", "crossing()")
68+
lifecycle::deprecate_warn("1.0.0", "crossing_()", "crossing()", always = TRUE)
6969
x <- compat_lazy_dots(x, caller_env())
7070
crossing(!!!x)
7171
}
7272
#' @rdname deprecated-se
7373
#' @export
7474
nesting_ <- function(x) {
75-
lifecycle::deprecate_warn("1.2.0", "nesting_()", "nesting()")
75+
lifecycle::deprecate_warn("1.2.0", "nesting_()", "nesting()", always = TRUE)
7676
x <- compat_lazy_dots(x, caller_env())
7777
nesting(!!!x)
7878
}
@@ -82,7 +82,7 @@ nesting_ <- function(x) {
8282
#' @export
8383
extract_ <- function(data, col, into, regex = "([[:alnum:]]+)", remove = TRUE,
8484
convert = FALSE, ...) {
85-
lifecycle::deprecate_warn("1.0.0", "extract_()", "extract()")
85+
lifecycle::deprecate_warn("1.0.0", "extract_()", "extract()", always = TRUE)
8686
UseMethod("extract_")
8787
}
8888
#' @export
@@ -104,7 +104,7 @@ extract_.data.frame <- function(data, col, into, regex = "([[:alnum:]]+)",
104104
#' @param fill_cols Character vector of column names.
105105
#' @export
106106
fill_ <- function(data, fill_cols, .direction = c("down", "up")) {
107-
lifecycle::deprecate_warn("1.2.0", "fill_()", "fill()")
107+
lifecycle::deprecate_warn("1.2.0", "fill_()", "fill()", always = TRUE)
108108
UseMethod("fill_")
109109
}
110110
#' @export
@@ -123,7 +123,7 @@ fill_.data.frame <- function(data, fill_cols, .direction = c("down", "up", "down
123123
#' @export
124124
gather_ <- function(data, key_col, value_col, gather_cols, na.rm = FALSE,
125125
convert = FALSE, factor_key = FALSE) {
126-
lifecycle::deprecate_warn("1.2.0", "gather_()", "gather()")
126+
lifecycle::deprecate_warn("1.2.0", "gather_()", "gather()", always = TRUE)
127127
UseMethod("gather_")
128128
}
129129
#' @export
@@ -149,7 +149,7 @@ gather_.data.frame <- function(data, key_col, value_col, gather_cols,
149149
#' @keywords internal
150150
#' @export
151151
nest_ <- function(...) {
152-
lifecycle::deprecate_stop("1.0.0", "nest_()", "nest()")
152+
lifecycle::deprecate_stop("1.0.0", "nest_()", "nest()", always = TRUE)
153153
}
154154

155155
#' @rdname deprecated-se
@@ -172,7 +172,7 @@ separate_rows_.data.frame <- function(data, cols, sep = "[^[:alnum:].]+",
172172
#' @export
173173
separate_ <- function(data, col, into, sep = "[^[:alnum:]]+", remove = TRUE,
174174
convert = FALSE, extra = "warn", fill = "warn", ...) {
175-
lifecycle::deprecate_warn("1.2.0", "separate_()", "separate()")
175+
lifecycle::deprecate_warn("1.2.0", "separate_()", "separate()", always = TRUE)
176176
UseMethod("separate_")
177177
}
178178
#' @export
@@ -197,7 +197,7 @@ separate_.data.frame <- function(data, col, into, sep = "[^[:alnum:]]+",
197197
#' @export
198198
spread_ <- function(data, key_col, value_col, fill = NA, convert = FALSE,
199199
drop = TRUE, sep = NULL) {
200-
lifecycle::deprecate_warn("1.2.0", "spread_()", "spread()")
200+
lifecycle::deprecate_warn("1.2.0", "spread_()", "spread()", always = TRUE)
201201
UseMethod("spread_")
202202
}
203203
#' @export
@@ -221,7 +221,7 @@ spread_.data.frame <- function(data, key_col, value_col, fill = NA,
221221
#' @param from Names of existing columns as character vector
222222
#' @export
223223
unite_ <- function(data, col, from, sep = "_", remove = TRUE) {
224-
lifecycle::deprecate_warn("1.2.0", "unite_()", "unite()")
224+
lifecycle::deprecate_warn("1.2.0", "unite_()", "unite()", always = TRUE)
225225
UseMethod("unite_")
226226
}
227227
#' @export

R/unnest.R

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ unnest <- function(data,
8383
.preserve = deprecated()) {
8484
deprecated <- FALSE
8585
if (!missing(.preserve)) {
86-
lifecycle::deprecate_warn("1.0.0", "unnest(.preserve = )",
87-
details = "All list-columns are now preserved"
86+
lifecycle::deprecate_warn(
87+
"1.0.0",
88+
"unnest(.preserve = )",
89+
details = "All list-columns are now preserved",
90+
always = TRUE
8891
)
8992
deprecated <- TRUE
9093
.preserve <- tidyselect::vars_select(tbl_vars(data), !!enquo(.preserve))
@@ -118,15 +121,21 @@ unnest <- function(data,
118121
}
119122

120123
if (!is_missing(.drop)) {
121-
lifecycle::deprecate_warn("1.0.0", "unnest(.drop = )",
122-
details = "All list-columns are now preserved."
124+
lifecycle::deprecate_warn(
125+
"1.0.0",
126+
"unnest(.drop = )",
127+
details = "All list-columns are now preserved.",
128+
always = TRUE
123129
)
124130
deprecated <- TRUE
125131
}
126132

127133
if (!is_missing(.id)) {
128-
lifecycle::deprecate_warn("1.0.0", "unnest(.id = )",
129-
details = "Manually create column of names instead."
134+
lifecycle::deprecate_warn(
135+
"1.0.0",
136+
"unnest(.id = )",
137+
details = "Manually create column of names instead.",
138+
always = TRUE
130139
)
131140
deprecated <- TRUE
132141
first_col <- tidyselect::vars_select(tbl_vars(data), !!cols)[[1]]

0 commit comments

Comments
 (0)