I recently downloaded this version of R:
R version 3.4.0 (2017-04-21) -- "You Stupid Darkness" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin15.6.0 (64-bit)library(data.table)
The behavior for setkey() and unique() on data tables has changed. Previous versions of R (3.3.3) would not return 7 rows in the following example since there are two rows with V2=="D". This seems like a big change - is this intended?
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)]
+ )
setkey(dt, "V2")
unique(dt)
V1 V2
1: B A
2: A B
3: A C
4: A D
5: C D
6: E F
7: G G
str(dt)
Classes ‘data.table’ and 'data.frame': 10 obs. of 2 variables:
$ V1: chr "B" "A" "A" "A" ...
$ V2: chr "A" "B" "B" "B" ...
- attr(*, ".internal.selfref")=<externalptr>
- attr(*, "sorted")= chr "V2"