Let\'s say I have the below data.table:
DT <- data.table(x=rep(c(1,2),3),y=rep(1,6),z=rep(2,6)) DT x y z 1: 1 1 2 2: 2 1 2 3: 1 1 2 4: 2 1 2 5: 1 1 2 6