Helpers to apply a filter across a selection of columns.
if_all(.cols = everything(), .fns = NULL, ...)
if_any(.cols = everything(), .fns = NULL, ...)
Selection of columns
Function to create filter conditions
Other arguments passed to the function
iris %>%
filter(if_any(ends_with("Width"), ~ .x > 4))
#> # A tidytable: 3 × 5
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <dbl> <dbl> <dbl> <dbl> <fct>
#> 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(if_all(ends_with("Width"), ~ .x > 2))
#> # A tidytable: 23 × 5
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 6.3 3.3 6 2.5 virginica
#> 2 7.1 3 5.9 2.1 virginica
#> 3 6.5 3 5.8 2.2 virginica
#> 4 7.6 3 6.6 2.1 virginica
#> 5 7.2 3.6 6.1 2.5 virginica
#> 6 6.8 3 5.5 2.1 virginica
#> 7 5.8 2.8 5.1 2.4 virginica
#> 8 6.4 3.2 5.3 2.3 virginica
#> 9 7.7 3.8 6.7 2.2 virginica
#> 10 7.7 2.6 6.9 2.3 virginica
#> # ℹ 13 more rows