[R] how to reshape an array avoiding for loops

From: Wladimir Eremeev <wl_at_eimb.ru>
Date: Wed 17 Aug 2005 - 07:12:04 EST

Dear r-help,

  I have an array a1 with dimensions [1:660,1:65,1:25]   I would like the first dimension to be the last one.   That is I want and array [1:65,1:25,1:660]

  The only way to do this, I know, is   

  for(i in 1:dim(a1)[1]) tmp.a[,,i]<-a1[i,,]   a1<-tmp.a

  Is it possible to avoid 'for' loop here?

  Thank you!

Best regards,
Wladimir                mailto:wl@eimb.ru

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Aug 17 07:17:53 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:50 EST