I am wondering if it is possible to subset a data.table by reference.
A solution that involves updating by assignment is:
iris <- as.data.table(iris)
iris <- iris[Species == "virginica"]
The downside of this approach is it copies the filtered data.table. If possible, I would like to filter by reference, possibly using the :=
operator and the .SD
shortcut.