I am currently in the process of tiding the way in write my R scripts, so I am not really looking for an answer outside the tidyverse or using deprecated / superseded syntaxes. I find dplyr's way of manipulating data easy to write and read, so I try to stick to it.
Using the iris dataset, here is a simplified version of what I want to do, in the superseded syntax (which works fine):
filter_at(iris, vars(starts_with("sepal")), any_vars(. > 3))
Obviously, I could write the condition in the long form to avoid using filter_at() and any_vars() :
filter(iris, Sepal.Length > 3 | Sepal.Width > 3)
but it is redundant, and mostly, if like in my case the column names are not known fully, not applicable.
In dplyr's vignette("colwise"), it is stated:
Previously, filter() was paired with the all_vars() and any_vars() helpers. Now, across() is equivalent to all_vars(), and there’s no direct replacement for any_vars(). However you can make a simple helper yourself:
followed by a super trivial example (any value > 0, so we only need using rowSums()). I feel like it's lacking a disjunctive version of across() in the specific case of filtering to maintain the same expressivity.
In your opinion, what would be the cleanest syntax to achieve the same filtering without having to enumerate all the columns or to use superseded functions?