Given a list of 4-tuples as follows.
data = Tuples[Range@6, 4];
I want to select any 4-tuples with two pairs of different twins, for example, as follows:
{1,2,1,2}
{2,2,3,3}
{4,5,5,4}
- etc
Attempt
First I select any association with length of 2 as follows
filter1 = Select[Counts /@ data, Length@# == 2 &]
Second I want to select only any association with value of 2. How to do this?
data[[Flatten@Position[Sort /@ data, {x_, x_, y_, y_} /; x != y]]]
does work as well but too complicated. $\endgroup$