Not sure if this is corrected in the latest build on R-Forge but will report it
anyway:
CJ doesn't do the cross product correctly:
require(data.table)
Y <- factor(1:2, levels=1:2, labels=c("MATHEMATICS", "READING"))
Z <- factor(1:3, levels=1:3, labels=paste(2008:2010, 2009:2011, sep="_"))
tmp.cj <- CJ(Y,Z)
> tmp.cj
V1 V2
[1,] MATHEMATICS 2008_2009
[2,] MATHEMATICS 2009_2010
[3,] MATHEMATICS 2010_2011
[4,] READING 2008_2009
[5,] READING 2009_2010
[6,] READING 2010_2011
### But subsetting tmp.cj shows weird behavior (the V2 levels disappear in some
cases)
> tmp.cj[1:3]
V1 V2
[1,] MATHEMATICS 2008_2009
[2,] MATHEMATICS 2009_2010
[3,] MATHEMATICS 2010_2011
> tmp.cj[4:6]
V1 V2
[1,] READING <NA>
[2,] READING <NA>
[3,] READING <NA>
Any insight on the above greatly appreciated
Damian
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help