我有一个数组,包含两个熟练变量(theta0, theta1)和一个名为"comp"的项目(是,否)。这需要转换为一个矩阵。有没有办法将底部的矩阵转换成一个矩阵?
我的数组长这样:
>priCPT.i6
, , comp = Yes
theta1
theta0 Low Med High
Low 0.8377206 0.6760511 0.4576021
Med 0.6760511 0.4576021 0.2543239
High 0.4576021 0.2543239 0.1211734
, , comp = No
theta1
theta0 Low Med High
Low 0.1622794 0.3239489 0.5423979
Med 0.3239489 0.5423979 0.7456761
High 0.5423979 0.7456761 0.8788266
attr(,"class")
[1] "CPA" "array"
我很抱歉,我无法提供一个你可以玩耍的东西。我正在寻找像这样的东西:
theta0 theta1 Yes No
Low Low 0.8377206 0.1622794
Low Med .. ..
Low High .. ..
Med Low .. ..
Med Med .. ..
Med High .. ..
High Low .. ..
High Med .. ..
High High .. ..
Regards...
tidyr::spread(as.data.frame.table(priCPT.i6), Var3, Freq)
- alistaire