0

I have two matrices x and y and a name_list that contains "x" and "y"

name_list <- list("x","y") 
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

How do I create a list of matrices "matrix_list" using name_list instead of

matrix_list <- list(x,y)

I tried

lapply(name_list,list)

but that gets

[[1]]
[[1]][[1]]
[1] "x"


[[2]]
[[2]][[1]]
[1] "y"

0 Answers0