Skip to content

[R] Deprecated filter + across usage聽#14734

Closed

Description

@boshek

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:

https://github.com/tidyverse/dplyr/blob/4d0ac622c0e33c758b05a1582766fcd438cb79c1/R/filter.R#L269-L277

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:

arrow/r/R/dplyr-across.R

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

Activity

  1. thisisnic commented on Nov 25, 2022

    @thisisnic
    Member

    Thanks for reporting this, I agree we should add a deprecation message.

  2. changed the title [-]Deprecated filter + across usage[/-] [+][R] Deprecated filter + across usage[/+] on Nov 25, 2022
  3. added a commit that references this issue on Sep 17, 2026
  4. added this to the 26.0.0 milestone on Sep 17, 2026
  5. thisisnic commented on Sep 17, 2026

    @thisisnic
    Member

    Issue resolved by pull request 51235
    #51235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions