This is a method for the dplyr dplyr::filter() generic. It generates the
WHERE clause of the SQL query.
Usage
# S3 method for class 'tbl_lazy'
filter(.data, ..., .by = NULL, .preserve = FALSE)Arguments
- .data
A lazy data frame backed by a database query.
- ...
<
data-masking> Variables, or functions of variables. Usedesc()to sort a variable in descending order.- .by
-
<
tidy-select> Optionally, a selection of columns to group by for just this operation, functioning as an alternative togroup_by(). For details and examples, see ?dplyr_by. - .preserve
Not supported by this method.
Value
Another tbl_lazy. Use dplyr::show_query() to see the generated
query, and use collect() to execute the query
and return data to R.
Examples
library(dplyr, warn.conflicts = FALSE)
db <- memdb_frame(x = c(2, NA, 5, NA, 10), y = 1:5)
db %>% filter(x < 5) %>% show_query()
#> <SQL>
#> SELECT `dbplyr_FwkzgfuPO1`.*
#> FROM `dbplyr_FwkzgfuPO1`
#> WHERE (`x` < 5.0)
db %>% filter(is.na(x)) %>% show_query()
#> <SQL>
#> SELECT `dbplyr_FwkzgfuPO1`.*
#> FROM `dbplyr_FwkzgfuPO1`
#> WHERE ((`x` IS NULL))
