Choose rows where conditions are true.
filter_dt(.data, ...)
data.table
iris %>% filter_dt(Sepal.Length > 7)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <num> <num> <num> <num> <fctr>
#> 1: 7.1 3.0 5.9 2.1 virginica
#> 2: 7.6 3.0 6.6 2.1 virginica
#> 3: 7.3 2.9 6.3 1.8 virginica
#> 4: 7.2 3.6 6.1 2.5 virginica
#> 5: 7.7 3.8 6.7 2.2 virginica
#> 6: 7.7 2.6 6.9 2.3 virginica
#> 7: 7.7 2.8 6.7 2.0 virginica
#> 8: 7.2 3.2 6.0 1.8 virginica
#> 9: 7.2 3.0 5.8 1.6 virginica
#> 10: 7.4 2.8 6.1 1.9 virginica
#> 11: 7.9 3.8 6.4 2.0 virginica
#> 12: 7.7 3.0 6.1 2.3 virginica
iris %>% filter_dt(Sepal.Length == max(Sepal.Length))
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <num> <num> <num> <num> <fctr>
#> 1: 7.9 3.8 6.4 2 virginica
# comma is not supported in tidyfst after v0.9.8
# which means you can't use:
if (FALSE) { # \dontrun{
iris %>% filter_dt(Sepal.Length > 7, Sepal.Width > 3)
} # }
# use following code instead
iris %>% filter_dt(Sepal.Length > 7 & Sepal.Width > 3)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <num> <num> <num> <num> <fctr>
#> 1: 7.2 3.6 6.1 2.5 virginica
#> 2: 7.7 3.8 6.7 2.2 virginica
#> 3: 7.2 3.2 6.0 1.8 virginica
#> 4: 7.9 3.8 6.4 2.0 virginica