Alos Alos - 7 months ago 29
R Question

How to convert a matrix to a 1 dimensional array in R?

I have a large matrix (32X48).
How can I convert the matrix into a single dimensional array in R?


If we're talking about data.frame, then you should ask yourself are the variables of the same type? If that's the case, you can use rapply, or unlist, since data.frames are lists, deep down in their souls...

 rapply(mtcars, c) # completely stupid and pointless, and slower