Analogous function for filter
in dplyr.
filter(.data, ...)
A data.table
Currently data.table is not able to delete rows by reference,
https://github.com/Rdatatable/data.table/issues/635
https://stackoverflow.com/questions/10790204/how-to-delete-a-row-by-reference-in-data-table
iris = as.data.table(iris)
iris %>% filter(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(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
iris %>% filter(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
iris %>% filter(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