[R] reshape matrices

From: Francisco Javier Santos Alamillos <fjsanala_at_gmail.com>
Date: Tue, 01 Jul 2008 11:58:31 +0200


Hello everyone,

I need reshape an array. For example, if we have next array:

> a <- c(1,2,3,4,5,6,7,8,9,10,11,12)
> dim(a) <- c(2,2,3)
> a
, , 1

     [,1] [,2]
[1,] 1 3
[2,] 2 4

, , 2

     [,1] [,2]
[1,] 5 7
[2,] 6 8

, , 3

     [,1] [,2]
[1,] 9 11
[2,] 10 12

I need to get next matrices:

1 2 3 4
5 6 7 8
9 10 11 12

1 3 2 4
5 7 6 8
9 11 10 12

It exist any function that can be able to do it?

Thanks and sorry for my english.

        [[alternative HTML version deleted]]



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 Tue 01 Jul 2008 - 15:29:29 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 Tue 01 Jul 2008 - 16:31:09 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