Learn R Programming

tidytable (version 0.5.1)

filter.: Filter rows on one or more conditions

Description

Filters a dataset to choose rows where conditions are true.

Usage

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

dt_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

Run this code
# NOT RUN {
test_df <- tidytable(
  a = c(1,2,3),
  b = c(4,5,6),
  c = c("a","a","b"))

test_df %>%
  filter.(a >= 2, b >= 4)

test_df %>%
  filter.(b <= mean(b), by = c)
# }

Run the code above in your browser using DataLab