The filter()
function extension subsets tm
that satisfy set conditions.
To be retained, the tm
object must produce a value of TRUE
for all conditions.
Note that when a condition evaluates to NA
, the row will be dropped, unlike
base subsetting with [
.
Usage
# S3 method for tm
filter(.data, ...)
Arguments
- .data
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details.
- ...
<
data-masking
> Expressions that return a logical value, and are defined in terms of the variables in.data
. If multiple expressions are included, they are combined with the&
operator. Only rows for which all conditions evaluate toTRUE
are kept.
Value
An object of the same type as .data
. The output as the following properties:
tm
objects are a subset of the input, but appear in the same orderUnderlying
data.frame
columns are not modifiedUnderlying
data.frame
object's attributes are preserved
See also
dplyr::filter()
for examples of generic implementation