is this the most straightforward way to convert an array into a data.table?
require(data.table)
require(ggplot2)
# this returns a data.tabl
only works for versions 1.11.4 and 1.11.2 but not for some earlier versions
both approaches essentially return the same data.table but with A=1, B=2, C=3 in your second approach, and rows ordered in different ways. so the second approach is the way to go.
DT2 <- as.data.table(aaa)
head(DT2)
# V1 V2 V3 value
#1: 1 1 1 0.32337516
#2: 1 1 2 1.59189589
#3: 1 2 1 -1.48751756
#4: 1 2 2 -0.86749305
#5: 1 3 1 0.01017255
#6: 1 3 2 2.66571093
#compare
DT[order(Freq), ]
#and
DT2[order(value), ]