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

Advance all lazyeval functions to the defunct stage #1281

Closed
Closed
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
10 changes: 0 additions & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# Generated by roxygen2: do not edit by hand

S3method(complete,data.frame)
S3method(complete_,data.frame)
S3method(drop_na,data.frame)
S3method(drop_na_,data.frame)
S3method(expand,data.frame)
S3method(expand,grouped_df)
S3method(expand_,data.frame)
S3method(extract,data.frame)
S3method(extract_,data.frame)
S3method(fill,data.frame)
S3method(fill_,data.frame)
S3method(full_seq,Date)
S3method(full_seq,POSIXct)
S3method(full_seq,numeric)
S3method(gather,data.frame)
S3method(gather_,data.frame)
S3method(nest,data.frame)
S3method(nest,grouped_df)
S3method(nest,tbl_df)
Expand All @@ -26,13 +20,9 @@ S3method(pivot_wider,data.frame)
S3method(replace_na,data.frame)
S3method(replace_na,default)
S3method(separate,data.frame)
S3method(separate_,data.frame)
S3method(separate_rows,data.frame)
S3method(separate_rows_,data.frame)
S3method(spread,data.frame)
S3method(spread_,data.frame)
S3method(unite,data.frame)
S3method(unite_,data.frame)
S3method(unnest,data.frame)
S3method(unnest,rowwise_df)
S3method(unnest_legacy,data.frame)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# tidyr (development version)

* All lazyeval functions are now defunct. They have been deprecated for awhile
now and will be completely removed in the next minor release of tidyr. (See
[lifecycle](https://lifecycle.r-lib.org/articles/lifecycle.html) for
details on deprecation stages).

* `expand()`, `crossing()`, and `nesting()` now correctly retain `NA` values of
factors (#1275).

Expand Down
130 changes: 17 additions & 113 deletions R/dep-lazyeval.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# nocov start

#' Deprecated SE versions of main verbs
#' Defunct SE versions of main verbs
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#' `r lifecycle::badge("defunct")`
#'
#' tidyr used to offer twin versions of each verb suffixed with an
#' underscore. These versions had standard evaluation (SE) semantics:
Expand All @@ -29,86 +29,49 @@ NULL
#' @inheritParams complete
#' @export
complete_ <- function(data, cols, fill = list(), ...) {
lifecycle::deprecate_warn("1.0.0", "complete_()", "complete()")
UseMethod("complete_")
}
#' @export
complete_.data.frame <- function(data, cols, fill = list(), ...) {
cols <- compat_lazy_dots(cols, caller_env())
complete(data, !!! cols, fill = fill)
lifecycle::deprecate_stop("1.2.0", "complete_()", "complete()")
}

#' @rdname deprecated-se
#' @export
drop_na_ <- function(data, vars) {
lifecycle::deprecate_warn("1.0.0", "drop_na_()", "drop_na()")
UseMethod("drop_na_")
}
#' @export
drop_na_.data.frame <- function(data, vars) {
drop_na(data, !!! vars)
lifecycle::deprecate_stop("1.2.0", "drop_na_()", "drop_na()")
}

#' @rdname deprecated-se
#' @param expand_cols Character vector of column names to be expanded.
#' @export
expand_ <- function(data, dots, ...) {
lifecycle::deprecate_warn("1.0.0", "expand_()", "expand()")
UseMethod("expand_")
}
#' @export
expand_.data.frame <- function(data, dots, ...) {
dots <- compat_lazy_dots(dots, caller_env())
expand(data, !!! dots)
lifecycle::deprecate_stop("1.2.0", "expand_()", "expand()")
}

#' @rdname deprecated-se
#' @param x For `nesting_` and `crossing_` a list of variables.
#' @export
crossing_ <- function(x) {
lifecycle::deprecate_warn("1.0.0", "crossing_()", "crossing()")
x <- compat_lazy_dots(x, caller_env())
crossing(!!! x)
lifecycle::deprecate_stop("1.2.0", "crossing_()", "crossing()")
}

#' @rdname deprecated-se
#' @export
nesting_ <- function(x) {
x <- compat_lazy_dots(x, caller_env())
nesting(!!! x)
lifecycle::deprecate_stop("1.2.0", "nesting_()", "nesting()")
}

#' @rdname deprecated-se
#' @inheritParams extract
#' @export
extract_ <- function(data, col, into, regex = "([[:alnum:]]+)", remove = TRUE,
convert = FALSE, ...) {
lifecycle::deprecate_warn("1.0.0", "extract_()", "extract()")
UseMethod("extract_")
}
#' @export
extract_.data.frame <- function(data, col, into, regex = "([[:alnum:]]+)",
remove = TRUE, convert = FALSE, ...) {
col <- compat_lazy(col, caller_env())
extract(data,
col = !! col,
into = into,
regex = regex,
remove = remove,
convert = convert,
...
)
lifecycle::deprecate_stop("1.2.0", "extract_()", "extract()")
}

#' @rdname deprecated-se
#' @inheritParams fill
#' @param fill_cols Character vector of column names.
#' @export
fill_ <- function(data, fill_cols, .direction = c("down", "up")) {
UseMethod("fill_")
}
#' @export
fill_.data.frame <- function(data, fill_cols, .direction = c("down", "up", "downup", "updown")) {
vars <- syms(fill_cols)
fill(data, !!! vars, .direction = .direction)
lifecycle::deprecate_stop("1.2.0", "fill_()", "fill()")
}

#' @rdname deprecated-se
Expand All @@ -121,24 +84,7 @@ fill_.data.frame <- function(data, fill_cols, .direction = c("down", "up", "down
#' @export
gather_ <- function(data, key_col, value_col, gather_cols, na.rm = FALSE,
convert = FALSE, factor_key = FALSE) {
UseMethod("gather_")
}
#' @export
gather_.data.frame <- function(data, key_col, value_col, gather_cols,
na.rm = FALSE, convert = FALSE,
factor_key = FALSE) {
key_col <- sym(key_col)
value_col <- sym(value_col)
gather_cols <- syms(gather_cols)

gather(data,
key = !! key_col,
value = !! value_col,
!!! gather_cols,
na.rm = na.rm,
convert = convert,
factor_key = factor_key
)
lifecycle::deprecate_stop("1.2.0", "gather_()", "gather()")
}

#' @rdname deprecated-se
Expand All @@ -154,74 +100,32 @@ nest_ <- function(...) {
#' @export
separate_rows_ <- function(data, cols, sep = "[^[:alnum:].]+",
convert = FALSE) {
UseMethod("separate_rows_")
}
#' @export
separate_rows_.data.frame <- function(data, cols, sep = "[^[:alnum:].]+",
convert = FALSE) {
cols <- syms(cols)
separate_rows(data, !!! cols, sep = sep, convert = convert)
lifecycle::deprecate_stop("1.2.0", "separate_rows_()", "separate_rows()")
}

#' @rdname deprecated-se
#' @inheritParams separate
#' @export
separate_ <- function(data, col, into, sep = "[^[:alnum:]]+", remove = TRUE,
convert = FALSE, extra = "warn", fill = "warn", ...) {
UseMethod("separate_")
}
#' @export
separate_.data.frame <- function(data, col, into, sep = "[^[:alnum:]]+",
remove = TRUE, convert = FALSE,
extra = "warn", fill = "warn", ...) {
col <- sym(col)
separate(data,
col = !! col,
into = into,
sep = sep,
remove = remove,
convert = convert,
extra = extra,
fill = fill,
...
)
lifecycle::deprecate_stop("1.2.0", "separate_()", "separate()")
}

#' @rdname deprecated-se
#' @inheritParams spread
#' @param key_col,value_col Strings giving names of key and value cols.
#' @export
spread_ <- function(data, key_col, value_col, fill = NA, convert = FALSE,
drop = TRUE, sep = NULL) {
UseMethod("spread_")
}
#' @export
spread_.data.frame <- function(data, key_col, value_col, fill = NA,
convert = FALSE, drop = TRUE, sep = NULL) {
key_col <- sym(key_col)
value_col <- sym(value_col)

spread(data,
key = !! key_col,
value = !! value_col,
fill = fill,
convert = convert,
drop = drop,
sep = sep
)
lifecycle::deprecate_stop("1.2.0", "spread_()", "spread()")
}

#' @rdname deprecated-se
#' @inheritParams unite
#' @param from Names of existing columns as character vector
#' @export
unite_ <- function(data, col, from, sep = "_", remove = TRUE) {
UseMethod("unite_")
}
#' @export
unite_.data.frame <- function(data, col, from, sep = "_", remove = TRUE) {
col <- quo_get_expr(compat_lazy(col, caller_env()))
from <- syms(from)
unite(data, !! col, !!! from, sep = sep, remove = remove)
lifecycle::deprecate_stop("1.2.0", "unite_()", "unite()")
}

#' @rdname deprecated-se
Expand Down
4 changes: 2 additions & 2 deletions man/deprecated-se.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading