[datatable-help] unique

Damian Betebenner dbetebenner at nciea.org
Sat Jun 25 23:23:55 CEST 2011


All,

I have a simple question regarding the behavior of unique with more than 1 key. Consider the example:

> dt <- data.table(X=c(NA,1,2,3), Y=c(NA,2,1,3))
> dt
      X  Y
[1,] NA NA
[2,]  1  2
[3,]  2  1
[4,]  3  3
> key(dt) <- c("X", "Y")
> unique(dt)
      X  Y
[1,] NA NA
[2,]  2  1
[3,]  3  3

If I understand this correctly, unique see rows 2 and 3 of dt as the same.

Is this the behavior one wants?

Thanks for any clarification.

Damian


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20110625/3c97c014/attachment.htm>


More information about the datatable-help mailing list