Description Usage Arguments Examples
A function to filter a data.frame, tibble or dplyr database connection table using boolean logical queries
1 | bool_filter(db_tbl, col, qry, case_sens = FALSE, print_call = FALSE)
|
db_tbl |
response variables - a special argument for the names of fields to include/omit in the response. e.g. return only "resp_vars=Species,Sepal.Length" or omit "resp_vars=-Species" |
col |
variables to sort response by - e.g. "sort_vars=Species,Sepal.Length" (mutiple variables) or "sort_vars=-Petal.Length" (reverse order) |
qry |
Maximum data rows to return |
print_call |
Maximum data rows to return |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Examples showing equivalent operations using dplyr::filter and stringr::str_detect
# Simple match
bool_filter(iris, 'Species', 'set')
# iris %>% filter(str_detect(Species, 'set'))
# AND query
bool_filter(iris, 'Species', 'vir AND ver')
# iris %>% filter(str_detect(Species, 'vir') & str_detect(Species, 'ver'))
# OR query
bool_filter(iris, 'Species', 'vir OR ver')
# iris %>% filter(str_detect(Species, 'vir') | str_detect(Species, 'ver'))
# NOT query
bool_filter(iris, 'Species', '-set')
# iris %>% filter(!str_detect(Species, 'set'))
# Note piping is not yet supported, so the following will fail:
iris %>% bool_filter('Species', 'set')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.