View source: R/filter_scoped_qc.R
filter_all_qc | R Documentation |
filter_all_qc
, filter_at_qc
, and filter_if_qc
return
identical objects as filter_all
, filter_at
, and
filter_if
respectively, except that they automatically print the
number of cases (i.e., rows) that do not meet the filter conditions and
that were thus dropped.
filter_all_qc(.tbl, .vars_predicate, .group_check = F)
filter_at_qc(.tbl, .vars, .vars_predicate, .group_check = F)
filter_if_qc(.tbl, .predicate, .vars_predicate, .group_check = F)
.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. |
.group_check |
a logical value, that when TRUE, will print a table with each group variable and columns called "n_rows_dropped" and "percent_dropped" that together indicate, for each group, how many row were dropped when performing filter. Default is FALSE, to avoid excess printing. If data is not grouped and .group_check = T, then an error is thrown. |
.vars |
A list of columns generated by |
.predicate |
A predicate function to be applied to the columns
or a logical vector. The variables for which |
An object of the same class as .data
. This object will be
identical to that which is returned when running the respective scoped
version of dplyr::filter
.
filter_all
practice_data <-
data.frame(
A = 1:12,
B = 6:17,
C = 8:19,
G = c(rep(c(1, 2), each = 6))
)
# Scoped filtering
filter_all_qc(practice_data, all_vars(. > 9))
filter_at_qc(practice_data, vars(B, C), any_vars(. > 9))
filter_if_qc(practice_data, is.integer, all_vars(. > 3))
# With grouped data and setting .group_check = T, you can see how many rows
# were dropped per group. Note that this will print a large table if you have
# a lot of groups.
grouped_data <- group_by(practice_data, G)
filter_all_qc(grouped_data, dplyr::all_vars(. > 9), .group_check = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.