Description Usage Arguments Grouping variables Examples
View source: R/colwise-filter.R
Scoped verbs (_if, _at, _all) have been superseded by the use of
across() in an existing verb. See vignette("colwise") for details.
These scoped filtering verbs apply a predicate expression to a
selection of variables. The predicate expression should be quoted
with all_vars() or any_vars() and should mention the pronoun
. to refer to variables.
| 1 2 3 4 5 | 
| .tbl | A  | 
| .vars_predicate | A quoted predicate expression as returned by
 Can also be a function or purrr-like formula. In this case, the intersection of the results is taken by default and there's currently no way to request the union. | 
| .preserve | when  | 
| .predicate | A predicate function to be applied to the columns
or a logical vector. The variables for which  | 
| .vars | A list of columns generated by  | 
The grouping variables that are part of the selection are taken into account to determine filtered rows.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # While filter() accepts expressions with specific variables, the
# scoped filter verbs take an expression with the pronoun `.` and
# replicate it over all variables. This expression should be quoted
# with all_vars() or any_vars():
all_vars(is.na(.))
any_vars(is.na(.))
# You can take the intersection of the replicated expressions:
filter_all(mtcars, all_vars(. > 150))
# ->
filter(mtcars, if_all(everything(), ~ .x > 150))
# Or the union:
filter_all(mtcars, any_vars(. > 150))
# ->
filter(mtcars, if_any(everything(), ~ . > 150))
# You can vary the selection of columns on which to apply the
# predicate. filter_at() takes a vars() specification:
filter_at(mtcars, vars(starts_with("d")), any_vars((. %% 2) == 0))
# ->
filter(mtcars, if_any(starts_with("d"), ~ (.x %% 2) == 0))
# And filter_if() selects variables with a predicate function:
filter_if(mtcars, ~ all(floor(.) == .), all_vars(. != 0))
# ->
is_int <- function(x) all(floor(x) == x)
filter(mtcars, if_all(where(is_int), ~ .x != 0))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.