-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
featurea feature request or enhancementa feature request or enhancement
Milestone
Description
when we get a data frame from an expression in filter() perhaps we should & all its columns, this would enable something like
library(dplyr, warn.conflicts = FALSE)
iris %>%
filter(across(starts_with("Sepal"), ~ . > 4))
#> Error: filter() expressions should return logical vectors of the same size as the group
iris %>%
filter(Sepal.Length > 4 & Sepal.Width > 4)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.7 4.4 1.5 0.4 setosa
#> 2 5.2 4.1 1.5 0.1 setosa
#> 3 5.5 4.2 1.4 0.2 setosa
iris %>%
filter_at(vars(starts_with("Sepal")), all_vars(. > 4))
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.7 4.4 1.5 0.4 setosa
#> 2 5.2 4.1 1.5 0.1 setosa
#> 3 5.5 4.2 1.4 0.2 setosaCreated on 2019-12-30 by the reprex package (v0.3.0.9000)
This might be a better model than the current strategy of tricking ... into a single expression with all_exprs()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement