Re: [R] Selected matrices of an array and put into a list

2012-11-12 Thread arun
Hi, You can also use ?alply() library(plyr) BB<-array(sample(1:500,3*5*27,replace=TRUE),dim=c(3,5,27)) res<-alply(BB,3,function(x) x)[2:27] str(res) List of 26 #$ 2 : int [1:3, 1:5] 337 476 331 481 168 111 439 151 399 430 ... # $ 3 : int [1:3, 1:5] 77 171 225 498 277 37 429 472 215 351 ... # $ 4

Re: [R] Selected matrices of an array and put into a list

2012-11-12 Thread D. Rizopoulos
One approach is: BB <- rnorm(6*5*27) dim(BB) <- c(6, 5, 27) lapply(2:27, function (i) BB[, , i]) I hope it helps. Best, Dimitris On 11/12/2012 8:56 AM, Haris Rhrlp wrote: > Dear R users, > > I have an array that has matrices that i want BB[16,5,2:27] > i want to put each of the 26 matrices i