Skip to Content

the elements of a character vector are lists - how to combine them

given that I have a vector: x <- c("m1", "m2", "m3") and every element m1, m2 and m3 is a list e.g.

m1 = list(a=1:3, b=2:4, c=1:10)  
m2 = list(a=0:3, b=0:4, c=6:10)  
m3 = list(a=1:30, b=1:2, c=6:10)  

I want to be able to create "super list" using loop:

mylist <- list()  
for(i in x)mylist[[i]] <- ...??....  

when i="m1" then mylist[["m1"]] <- m1

any suggestion would be appreciate.

Robert