I am sure this must have a solution somewhere here but I really failed to find it. There is something along the same here, but then not really. Say I have a nested list of variable lengths - below length is 2:
L = list('Z1' = c('z11', 'z12'), 'Z2' = c('z21', 'z22', 'z23'))
How do I get in base R all combinations of sublists. For short lists like L
one would do for instance:
> expand.grid(L[[1]], L[[2]])
Var1 Var2
1 z11 z21
2 z12 z21
3 z11 z22
4 z12 z22
5 z11 z23
6 z12 z23
But how is this achieved in the general case ?