dplyr (version 0.4.3)

filter: Return rows with matching conditions.

Description

Return rows with matching conditions.

Usage

filter(.data, ...)

filter_(.data, ..., .dots)

Arguments

.data
A tbl. All main verbs are S3 generics and provide methods for tbl_df, tbl_dt and tbl_sql.
...
Logical predicates. Multiple conditions are combined with &.
.dots
Used to work around non-standard evaluation. See vignette("nse") for details.

Value

An object of the same class as .data.

Data frame row names are silently dropped. To preserve, convert to an explicit variable.

See Also

Other single.table.verbs: arrange, arrange_; mutate, mutate_, transmute, transmute_; rename, rename_, select, select_; slice, slice_; summarise, summarise_, summarize, summarize_

Examples

Run this code
filter(mtcars, cyl == 8)
filter(mtcars, cyl < 6)

# Multiple criteria
filter(mtcars, cyl < 6 & vs == 1)
filter(mtcars, cyl < 6 | vs == 1)

# Multiple arguments are equivalent to and
filter(mtcars, cyl < 6, vs == 1)

Run the code above in your browser using DataCamp Workspace