I have 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 get only unique rows based on column C1 , while I want to delete the row only if it is identical to the other in all columns of C1, ..., C10 .
Is there any way to cancel the setkey() operation? I found this question , but it did not help solve my problem.
PS: I can get around the problem by setting all the columns in my data.table as keys using setkeyv(data, paste0("C", 1:10)) , but this is not at all an elegant / practical solution.
r duplicates key data.table
hellter
source share