Re: [R] Collapse an array

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 28 Feb 2008 17:20:52 -0300

Try this also:

apply(x, 4, rbind)

On 28/02/2008, Gang Chen <gangchen_at_mail.nih.gov> wrote:
> 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
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 28 Feb 2008 - 20:23:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Feb 2008 - 21:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive