I have a list of list with common structure
require(data.table)
l <- list(a1 = list(b=data.table(rnorm(3)), c=data.table(rnorm(3)), d=data.table(rnorm(3))),
a2 = list(b=data.table(rnorm(3)), c=data.table(rnorm(3)), d=data.table(rnorm(3))))
Sometimes it is easier for lapply
to change the structure to go from a 2x3 list to a 3x2 list like:
+a1---b +b---a1
---c ---a2
---d +c---a1
+a2---b to ---a2
---c +d---a1
---d ---a2
Is there an idiomatic way to do this ?
Can it be done without copying over all the tables (that may be very big) ?