[datatable-help] CJ is borked?

Chris Neff caneff at gmail.com
Fri Dec 2 13:33:59 CET 2011


When I use CJ in the latest SVN version with any sort of complex j
statement, the values get really wonky. This is also present in 1.7.4
I think because when trying to upgrade to it in our company, tests
started failing.
Simple example:

DT <- data.table(x=1:4,y=1:2,z=1,cnt=1)
key(DT) <- c("x","y","z")
DT[CJ(1:4,1:4,1:4)] # Behaves as expected
DT[CJ(1:4,1:4,1:4), sum(cnt>0)] # Outputs funky z values



Output of funky z values:
   x y          z V1
   1 1          1  1
   1 1          2 NA
   1 1          3 NA
   1 1          4 NA
   1 2 1073741965 NA
   1 2          0 NA
   1 2    9256376 NA
   1 2          0 NA
   1 3 1245208680 NA
   1 3      32663 NA
   1 3 1229609672 NA
   1 3      32663 NA
   1 4          3 NA
   1 4          0 NA
   1 4          4 NA
   1 4          4 NA
   2 1          4 NA
   2 1          0 NA
   2 1 1073741840 NA
   2 1          0 NA
   2 2    9256376 NA
   2 2          0 NA
   2 2 1245209856 NA
   2 2      32663 NA
   2 3 1245208624 NA
   2 3      32663 NA
   2 3          2 NA
   2 3          0 NA
   2 4    9897144 NA
   2 4          0 NA
   2 4    9907736 NA
   2 4          0 NA
   3 1 1090519054 NA
   3 1          0 NA
   3 1    9256376 NA
   3 1          0 NA
   3 2 1227807728 NA
   3 2      32663 NA
   3 2 1230800136 NA
   3 2      32663 NA
   3 3          2 NA
   3 3          0 NA
   3 3          0 NA
   3 3          0 NA
   3 4          0 NA
   3 4 1072693248 NA
   3 4 1073741837 NA
   3 4      32663 NA
   4 1    9256376 NA
   4 1          0 NA
   4 1 1230799968 NA
   4 1      32663 NA
   4 2 1245208904 NA
   4 2      32663 NA
   4 2          3 NA
   4 2          0 NA
   4 3          2 NA
   4 3         14 NA
   4 3          0 NA
   4 3          0 NA
   4 4 1358962697 NA
   4 4      32663 NA
   4 4    9256376 NA
   4 4          0 NA
cn x y          z V1


More information about the datatable-help mailing list