Skip to content

Conversation

@DavisVaughan
Copy link
Member

Closes #7758

Deprecated in 1.0.8, has been warning on every usage since Feb, 2022

I've added a special error message if we detect a data frame in filter(), as that is probably an across() call that should have been if_any() or if_all(). It may have false positives, but the message is crafted in a way that that is expected.

filter(mtcars, "x")
#> Error in `filter()`:
#> ℹ In argument: `"x"`.
#> Caused by error:
#> ! `..1` must be a logical vector, not the string "x".

filter(mtcars, across(mpg, is.na))
#> Error in `filter()`:
#> ℹ In argument: `across(mpg, is.na)`.
#> Caused by error:
#> ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
#> ℹ If you used `across()` to generate this data frame, please use `if_any()` or
#>   `if_all()` instead.

By removing support for data frames entirely, so now the incompatible type error is thrown. This nicely simplifies the `filter()` internals.
@DavisVaughan DavisVaughan requested a review from hadley November 12, 2025 21:31
@DavisVaughan DavisVaughan merged commit d1cecde into main Nov 12, 2025
14 checks passed
@DavisVaughan DavisVaughan deleted the feature/filter-deprecation-advance branch November 12, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advance warn_filter_across() and warn_filter_data_frame() to deprecate-stop

3 participants