filter: Filter rows on one or more conditions

View source: R/filter.R

filterR Documentation

Filter rows on one or more conditions

Description

Filters a dataset to choose rows where conditions are true.

Usage

filter(.df, ..., .by = NULL)

Arguments

.df

A data.frame or data.table

...

Conditions to filter by

.by

Columns to group by if filtering with a summary function

Examples

df <- tidytable(
  a = 1:3,
  b = 4:6,
  c = c("a", "a", "b")
)

df %>%
  filter(a >= 2, b >= 4)

df %>%
  filter(b <= mean(b), .by = c)

mtfairbanks/gdt documentation built on April 12, 2024, 6:51 p.m.