Try aperm(x, c(2,1,3)) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111
> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of MarcioRibeiro > Sent: Tuesday, February 24, 2009 9:50 AM > To: r-help@r-project.org > Subject: [R] Transpose array > > > Hi Listers, > Is there a way that I can transpose an array... > Suppose I have the following array... > > x<-array(c(1,2,3,4),dim=c(1,2,2)) > , , 1 > [,1] [,2] > [1,] 1 2 > , , 2 > [,1] [,2] > [1,] 3 4 > > And I would like to get the following result... > , , 1 > [,1] > [1,] 1 > [,2] 2 > , , 2 > [,1] [,2] > [1,] 3 > [,2] 4 > > Thanks in advance, > Marcio > -- > View this message in context: http://www.nabble.com/Transpose-array- > tp22184286p22184286.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.