Repository navigation
[R] Deprecated filter + across usage聽#14734
Copy link
Copy link
Closed
Description
Describe the bug, including details regarding any error messages, version, and platform.
馃憢 the addition of across and family of functions has been such a powerful addition to the arrow R package. Thank you!
Recently in dplyr itself filter + across was deprecated. dplyr now throws a warning when trying to do that:
library(dplyr)
starwars %>%
filter(across(height, ~ .x >= 100))
#> Warning: Using `across()` in `filter()` is deprecated, use `if_any()` or
#> `if_all()`.This is done here in dplyr:
Right now arrow does not warn:
library(dplyr)
library(arrow)
starwars %>%
arrow_table() %>%
filter(across(height, ~ .x >= 100)) %>%
collect()Though arrow doesn't have the same deprecation plumbing set up my initial thought is that we could add something in here to catch instances when filter + across are used:
Lines 26 to 72 in 2078af7
| if (is_call(quo_expr, c("across", "if_any", "if_all"))) { | |
| new_quos <- list() | |
| across_call <- match.call( | |
| definition = dplyr::across, | |
| call = quo_expr, | |
| expand.dots = FALSE, | |
| envir = quo_env | |
| ) | |
| if (!all(names(across_call[-1]) %in% c(".cols", ".fns", ".names"))) { | |
| abort("`...` argument to `across()` is deprecated in dplyr and not supported in Arrow") | |
| } | |
| if (!is.null(across_call[[".cols"]])) { | |
| cols <- across_call[[".cols"]] | |
| } else { | |
| cols <- quote(everything()) | |
| } | |
| setup <- across_setup( | |
| cols = !!as_quosure(cols, quo_env), | |
| fns = across_call[[".fns"]], | |
| names = across_call[[".names"]], | |
| .caller_env = quo_env, | |
| mask = .data, | |
| inline = TRUE | |
| ) | |
| new_quos <- quosures_from_setup(setup, quo_env) | |
| quos_out <- append(quos_out, new_quos) | |
| } else { | |
| quos_out <- append(quos_out, quo_in) | |
| } | |
| if (is_call(quo_expr, "if_any")) { | |
| quos_out <- append(list(), purrr::reduce(quos_out, combine_if, op = "|", envir = quo_get_env(quos_out[[1]]))) | |
| } | |
| if (is_call(quo_expr, "if_all")) { | |
| quos_out <- append(list(), purrr::reduce(quos_out, combine_if, op = "&", envir = quo_get_env(quos_out[[1]]))) | |
| } | |
| } | |
| new_quosures(quos_out) | |
| } |
Component(s)
R
Reactions are currently unavailable
Activity
thisisnic commentedon Nov 25, 2022
Thanks for reporting this, I agree we should add a deprecation message.
[-]Deprecated filter + across usage[/-][+][R] Deprecated filter + across usage[/+]GH-14734: [R] Deprecated filter + across usage (#51235)
thisisnic commentedon Sep 17, 2026
Issue resolved by pull request 51235
#51235