Reputation: 10119
I have the two lists (simple toy example)
X = list(A=list(a=1,b=2),B=list(a=10,b=20))
Y = list(A=list(c=3,d=4),B=list(c=30,d=40))
I would like to join them together in a list Z such that
Z$A = list(a=1,b=2,c=3,d=4)
and
Z$B = list(a=10,b=20,c=30,d=40)
Upvotes: 1
Views: 127
Reputation: 11128
Use this if i understood you correctly:
After edit of question:
Z <- mapply(c, X, Y, SIMPLIFY=FALSE)
The above will give the same result as mentioned in your question
Upvotes: 2
Reputation: 21
Try this:
c(X,Y) #gives the concatenation
list(X,Y) #gives a list of lists
Upvotes: 1