<div dir="ltr"><div>I just installed the new data.table versions. I tried both 1.9.0, available (binary) at <a href="http://datatable.r-forge.r-project.org/data.table_1.9.0.zip">http://datatable.r-forge.r-project.org/data.table_1.9.0.zip</a>, and 1.9.2 (CRAN) building from source (using Rtools)</div>
<div><br></div><div>After installing I run my BAU scripts and found out that I had different results... this is what I could made reproducible </div><div><br></div><div>1.8.10 </div><div><br></div><div>> library(data.table) </div>
<div>data.table 1.8.10 For help type: help("data.table") </div><div>> set.seed(1) </div><div>> dt <- data.table(id=rep(1:4, each=3), </div><div>+ var1 = rep(letters[1:3], 4), </div><div>
+ var2 = rnorm(12), </div><div>+ key="id,var1") </div><div>> dt </div><div> id var1 var2 </div><div> 1: 1 a -0.6264538 </div><div> 2: 1 b 0.1836433 </div><div>
3: 1 c -0.8356286 </div><div> 4: 2 a 1.5952808 </div><div> 5: 2 b 0.3295078 </div><div> 6: 2 c -0.8204684 </div><div> 7: 3 a 0.4874291 </div><div> 8: 3 b 0.7383247 </div><div> 9: 3 c 0.5757814 </div>
<div>10: 4 a -0.3053884 </div><div>11: 4 b 1.5117812 </div><div>12: 4 c 0.3898432 </div><div>> </div><div>> key(dt) </div><div>[1] "id" "var1" </div><div>> dt[.(unique(id)), list(var1, var2)] </div>
<div> id var1 var2 </div><div> 1: 1 a -0.6264538 </div><div> 2: 1 b 0.1836433 </div><div> 3: 1 c -0.8356286 </div><div> 4: 2 a 1.5952808 </div><div> 5: 2 b 0.3295078 </div><div> 6: 2 c -0.8204684 </div>
<div> 7: 3 a 0.4874291 </div><div> 8: 3 b 0.7383247 </div><div> 9: 3 c 0.5757814 </div><div>10: 4 a -0.3053884 </div><div>11: 4 b 1.5117812 </div><div>12: 4 c 0.3898432 </div><div><br></div><div>
1.9.0 </div><div><br></div><div><br></div><div>> library(data.table) </div><div>data.table 1.9.0 For help type: help("data.table") </div><div>Warning message: </div><div>package ‘data.table’ was built under R version 3.1.0 </div>
<div>> set.seed(1) </div><div>> dt <- data.table(id=rep(1:4, each=3), </div><div>+ var1 = rep(letters[1:3], 4), </div><div>+ var2 = rnorm(12), </div><div>+ key="id,var1") </div>
<div>> dt </div><div> id var1 var2 </div><div> 1: 1 a -0.6264538 </div><div> 2: 1 b 0.1836433 </div><div> 3: 1 c -0.8356286 </div><div> 4: 2 a 1.5952808 </div><div> 5: 2 b 0.3295078 </div>
<div> 6: 2 c -0.8204684 </div><div> 7: 3 a 0.4874291 </div><div> 8: 3 b 0.7383247 </div><div> 9: 3 c 0.5757814 </div><div>10: 4 a -0.3053884 </div><div>11: 4 b 1.5117812 </div><div>12: 4 c 0.3898432 </div>
<div>> </div><div>> key(dt) </div><div>[1] "id" "var1" </div><div>> dt[.(unique(id)), list(var1, var2)] </div><div> id var1 var2 </div><div> 1: 1 a -0.6264538 </div><div> 2: 1 a 0.1836433 </div>
<div> 3: 1 a -0.8356286 </div><div> 4: 2 a 1.5952808 </div><div> 5: 2 a 0.3295078 </div><div> 6: 2 a -0.8204684 </div><div> 7: 3 a 0.4874291 </div><div> 8: 3 a 0.7383247 </div><div> 9: 3 a 0.5757814 </div>
<div>10: 4 a -0.3053884 </div><div>11: 4 a 1.5117812 </div><div>12: 4 a 0.3898432 </div><div><br></div><div>1.9.2</div><div><br></div><div>> library("data.table", lib.loc="C:/Program Files/R/R-3.0.2/library")</div>
<div>data.table 1.9.2 For help type: help("data.table")</div><div>> set.seed(1)</div><div>> dt <- data.table(id=rep(1:4, each=3),</div><div>+ var1 = rep(letters[1:3], 4),</div><div>+ var2 = rnorm(12),</div>
<div>+ key="id,var1")</div><div>Error in forder(x, cols, sort = TRUE, retGrp = FALSE) : </div><div> object 'Cforder' not found</div><div>> dt</div><div> id var1 var2</div><div>
1: 1 a -0.6264538</div><div> 2: 1 b 0.1836433</div><div> 3: 1 c -0.8356286</div><div> 4: 2 a 1.5952808</div><div> 5: 2 b 0.3295078</div><div> 6: 2 c -0.8204684</div><div> 7: 3 a 0.4874291</div>
<div> 8: 3 b 0.7383247</div><div> 9: 3 c 0.5757814</div><div>10: 4 a -0.3053884</div><div>11: 4 b 1.5117812</div><div>12: 4 c 0.3898432</div><div>> </div><div>> key(dt)</div><div>[1] "id" "var1"</div>
<div>> dt[.(unique(id)), list(var1, var2)]</div><div>Error in `[.data.table`(dt, .(unique(id)), list(var1, var2)) : </div><div> object 'Cbmerge' not found</div><div><br></div><div>It seems that in the 1.9.0 version when you join using fewer keys than the whole set of keys, the first values of the remaining keys are "carried forward". Other column looks fine. </div>
<div><br></div><div>In the 1.9.2 instead some dependencies seem missing.</div><div><br></div><div><br></div>
</div>