[R] Collapse an array

Gang Chen gangchen at mail.nih.gov
Thu Feb 28 21:05:33 CET 2008


Suppose I have a 4-D array X with dimensions (dx, dy, dz, dp). I want  
to collapse the first 3 dimensions of X to make a 2-D array Y with  
dimensions (dx*dy*dz, dp). Instead of awkward looping, what is a good  
way to do this? Is there a similar function like reshape in Matlab?

Thanks,
Gang



More information about the R-help mailing list