Say I have vectors {a,b,c}
and {w,x,y,z}
. How can I get Mathematica to output an array {{a,w},{a,x},{a,y},{a,z},{b,w},{b,x},{b,y},{b,z},{c,w},{c,x},{c,y},{c,z}}
where we have all combinations of the vector components matched up. I can do this with some for loops but I'm hoping that I'm missing an easier way of doing this.
Probably, the equivalent of the expand.grid
function in R. Help is much appreciated!