Assuming I have two lists:
xx <- as.list(1:3)
yy <- as.list(LETTERS[1:3])
How can I combine two such that each element of the new list is a list of the corresponding elements of each list of components. Therefore, if I combined the two above, I should have got:
> combined_list
[[1]]
[[1]][[1]]
[1] 1
[[1]][[2]]
[1] "a"
[[2]]
[[2]][[1]]
[1] 2
[[2]][[2]]
[1] "b"
[[3]]
[[3]][[1]]
[1] 3
[[3]][[2]]
[1] "c"
If you can offer a solution, I would like to scale it to 3 or more.
source
share