Use filter() find rows/cases where conditions are true. Unlike base subsetting with [, rows where the condition evaluates to NA are dropped.

# S3 method for FDF
filter(.data, ...)

filter_int(.data, subset, check = TRUE)

filter(.data, ...)

Arguments

.data

A FDF.

...

Logical predicates defined in terms of the variables in .data. Multiple conditions are combined with &. Only rows where the condition evaluates to TRUE are kept.

These arguments are automatically quoted and evaluated in the context of the data frame. They support unquoting and splicing. See vignette("programming") for an introduction to these concepts.

subset

Integer vector to (further) subset .data$ind_row.

check

Whether to check subset? Default is TRUE.

Value

An object of the same class as .data.

Examples

(test <- FDF(datasets::iris))
#> # A Filebacked Data Frame with 150 rows and 5 columns.
filter(test, Species == "setosa")
#> # A Filebacked Data Frame with 50 rows and 5 columns.
filter(test, Species == "setosa", Sepal.Length < 5)
#> # A Filebacked Data Frame with 20 rows and 5 columns.
filter_int(test, 1:50)
#> # A Filebacked Data Frame with 50 rows and 5 columns.