I have a list below.
Suppose I want 1 element from group 1, 2 from group 2, 3 from group 3, 1 from groups 4 to 6. What is the most R-way to get all the different combinations of elements if the elements cannot be repeated.
So, for example: (A1, B1, B2, C1, C2, C3, D1, E1, F1) normal, but (A1, B1, B1, C1, C2, C3, D1, E1, F1) not?
itemNames <- list(group1 = c("A1", "A2", "A3", "A4", "A5", "A6"), group2 = c("B1", "B2", "B3", "B4", "B5", "B6"), group3 = c("C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10", "C11", "C12"), group4 = c("D1", "D2", "D3", "D4", "D5", "D6"), group5 = c("E1", "E2", "E3", "E4"), group6 = c("F1", "F2", "F3", "F4"))
Obviously, I can do this with 9 nested loops - waste. I played with melt and change2, but received nothing. Thanks!