I have an array, including two proficiency variables (theta0, theta1) over an item (Yes, No) called \"comp\". This needs to be converted to one matrix. Is there any way that
An alternative using reshape2 would be
x <- array(1:18, dim = c(3L, 3L, 2L), dimnames = list(
c("Low", "Medium", "High"),
c("Low", "Medium", "High"),
c("Yes", "No")))
library(reshape2)
df <- dcast(melt(x), Var1+Var2~Var3)
df
Var1 Var2 Yes No
1 Low Low 1 10
2 Low Medium 4 13
3 Low High 7 16
4 Medium Low 2 11
5 Medium Medium 5 14
6 Medium High 8 17
7 High Low 3 12
8 High Medium 6 15
9 High High 9 18