[R] Converting data frame into multidimensional array

Luk Arbuckle luk.arbuckle at gmail.com
Fri Oct 21 22:15:32 CEST 2011


Consider the following data frame

X <- data.frame(Titanic)

Does anyone know of an easy way to convert X into a multidimensional
array?  Example that doesn't work

X <- as.array(X, dim=c(4,2,2,2))

To do what I need, X needs to be converted into an array of dimensions
c(4,2,2,2) in this case, not a table.

Thanks in advance.



More information about the R-help mailing list