I have a data.table
(data
in the following) with 10 columns (C1, ..., C10
) and I want to delete duplicate rows.
I accidentally used setkey(data,C1)
, so now when I run unique(data)
I only get unique rows based on the column C1
, while I want to remove a row only if it's identical to another one on all the columns C1, ..., C10
.
Is there a way to undo the setkey()
operation? I found this question but it didn't help to solve my provlem.
PS: I can get around the problem by setting all columns in my data.table
as keys with setkeyv(data, paste0("C", 1:10))
, but this is not at all an elegant/practical solution.