Skip to content
Prev 31249 / 398506 Next

array to data.frame

Spencer> Dear Peter:
    Spencer> Does the following not work in certain situations:

    Spencer> A <- array(1:4, dim=c(2,2))
    Spencer> dimnames(A) <- list(NULL, c("a", "b"))
    Spencer> as.data.frame(A)

Of course,  array -> data.frame is trivial for 2-dim arrays aka
matrices.  But Jorge had a 3-dim. array (of a special type,
namely a contingency table!) for which Peter gave the solution.

For most other 3-or-more-dim.arrays, there's no corresponding
data frame structure I can think of.

    Spencer> Or is it deprecated for other reasons?

    Spencer> Thanks,
    Spencer> Spencer Graves
Peter Dalgaard BSA wrote:
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help