0

Suppose I have a length M list of lists, each sub-list is of the same length (N).
How could I efficiently refactor these lists so that I now have N lists of length M?

It would be similar to if you made a matrix of the lists and sliced by a different dimension.

I.E.

original <- list(list(1:3, 4:6), list(2:4, 5:7))
> final
[[1]]
[[1]][[1]]
1, 2, 3
[[1]][[2]]
2, 3, 4

[[2]]
[[2]][[1]]
4, 5, 6
[[2]]
[[2]][[2]]
5, 6, 7
jameselmore
  • 442
  • 9
  • 20

0 Answers0