I have such a situation. Some data. The table is "rbinded".
library(data.table) x <- data.table(id=c(1,2,3,4),dsp=c(5,6,7,8),status=c(FALSE,TRUE,FALSE,TRUE)) y <- data.table(id=c(1,2,3,4),dsp=c(6,6,7,8),status=c(FALSE,FALSE,FALSE,TRUE)) z <- data.table(id=c(1,2,3,4),dsp=c(5,6,9,8),status=c(FALSE,TRUE,FALSE,FALSE)) w <- data.table(id=c(1,2,3,4),dsp=c(5,6,7,NA),status=c(FALSE,TRUE,FALSE,TRUE)) setkey(x,id) setkey(y,id) setkey(z,id) setkey(w,id) Bigdt<-rbind(x,y,z,w)
I want to get ONLY non-duplicate lines like:
id dsp status 1 6 FALSE 2 6 FALSE 3 9 FALSE 4 8 FALSE 4 NA TRUE
So i tried
Resultdt<-Bigdt[!duplicated(Bigdt)]
but the result:
id dsp status 1 5 FALSE 2 6 TRUE 3 7 FALSE 4 8 TRUE
does not meet my expectations. I tried to use different methods (since rbind is optional), for example, merging, combining, etc., the data.table package seems to be potentially the one that contains the solution ... apparently. Any ideas?