Dear all,

I want to obtain the following result

[[1]]
, , 1, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 2, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

................

, , 9, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 10, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1


[[2]]
, , 1, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 2, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 3, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 4, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 5, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 1, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 2, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 3, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

This is the code I have written.
t  = c(  1 ,  2,  2 )
r<-as.vector(table(t))

mult<-vector("list",length(unique(t)))
for(i in 1:length(unique(t))){
for(k in 1:r[i]){
mult[[i]]<-array(1,dim=c(2,2,n[[i]][k],k))
}
}
mult

The results are correct for the array [[1]]. However for the array [[2]] I
get the following result:
[[2]]
, , 1, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 2, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 3, 1

     [,1] [,2]
[1,]    1    1
[2,]    1    1
, , 1, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 2, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

, , 3, 2

     [,1] [,2]
[1,]    1    1
[2,]    1    1

How could I correct the code?

	[[alternative HTML version deleted]]

