It is straightforward to filter a data.table
for unique or duplicated rows. An example for that is provided in Filtering out duplicated/non-unique rows in data.table.
I would like to know if there's a more efficient way than reassigning the data.table to a new object, which has the duplicated entries removed?
library(data.table)
dt <- data.table(
V1=LETTERS[c(1,1,1,1,2,3,3,5,7,1)],
V2=LETTERS[c(2,3,4,2,1,4,4,6,7,2)]
)
filtered.dt <- unique(dt, by = "V2")
Is there perhaps a more efficient way than this reassignment?