Suppose I have this matrix:
Matrix <- c(5, 2, 3, 1, 4,
0, 2, 3, 4, 1,
0, 0, 3, 4, 1,
0, 0, 0, 4, 1,
0, 0, 0, 0, 1)
Matrix <- matrix(Matrix, 5, 5)
fam <- list()
for (i in 1:3){
fam[i] <- array(0, dim = dim(Matrix))
}
Then I got this warning messages:
Warning messages:
1: In fam[i] <- array(0, dim = dim(Matrix)) :
number of items to replace is not a multiple of replacement length
2: In fam[i] <- array(0, dim = dim(Matrix)) :
number of items to replace is not a multiple of replacement length
3: In fam[i] <- array(0, dim = dim(Matrix)) :
number of items to replace is not a multiple of replacement length
Then the result is not as accepted:
> fam
[[1]]
[1] 0
[[2]]
[1] 0
[[3]]
[1] 0
However, without list it is work fine!!
> fam
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 0 0 0 0
[3,] 0 0 0 0 0
[4,] 0 0 0 0 0
[5,] 0 0 0 0 0
Where it is my mistake??