Mayou - 3 months ago 13

R Question

Consider the following list of lists:

`lst = list(list(c(1,2), c(3,4)),list(c(5,6), c(7,8)),list(c(9,10), c(11,12)))`

The list

`lst`

This is the result I am looking to achieve:

`res = list(c(1,2,5,6,9,10), c(3,4,7,8,11,12))`

I know that this can be achieved as follows in case of two separate lists:

`mapply(c, lst1, lst2)`

However, I am not sure how to replicate the same logic using a list of lists.

Any efficient way to achieve that? Please keep in mind that in reality,

`lst`

Thanks!

Source (Stackoverflow)

Comments