Filter a data.frame with parameters provided in a list

filter_using_list(df, filter_list, verbose = TRUE)

Arguments

df

the data.frame to filter

filter_list

a list of lists, named for target columns to filter, and containing filter parameters: values, and match_type. Match types can be "exact" or "grep" for text; "lt", "lteq", "gt", "gteq", or "eq" for numbers.

Value

a filtered data.frame

Examples

library(tasic2016data)

anno <- tasic_2016_anno

filter_list <- list(pass_qc_checks = list(values = "Y",
                                          match_type = "exact"),
                    primary_type = list(values = c("Pvalb","Vip"),
                                        match_type = "grep"))

filtered_anno <- anno %>%
  filter_using_list(filter_list)
#> No match found for primary_type. Filtering for other matches.
#> 1749 matches for pass_qc_checks