I want to create a list of 2D matrices
> x
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
> y
[,1] [,2]
[1,] 301 306
[2,] 302 307
[3,] 303 308
[4,] 304 309
[5,] 305 310
> MATS<-c(x,y)
> MATS[1]
[1] 1
I would like to be able to refer to MATS[1] as if it where x…
Try
Here you have to refer to
MATS[[1]]as if it werexIf you want to append a new matrix to the exiting list try
One drawback of this approach is that you have to know the position in the list where you have to append the new matrix, if you don’t know it or simply if you dont want this approach, then here’s a trick: