How to select 2 pairs of distinct twins form a list of 4-tuples?
Another way
Select[data, Values[Counts[#]] === {2, 2} &]
Try this:
Pick[data, Values[Counts[#]] === {2, 2} & /@ data]
A pattern based approach:
Cases[
data,
{x_, x_, y_, y_} | {x_, y_, x_, y_} | {x_, y_, y_, x_} /; x != y
]
or
Select[
data,
MatchQ[Sort[#], {x_, x_, y_, y_} /; x != y] &
]
Another approach is to construct the desired tuples directly without selection from a larger set:
Subsets[Range@6, {2}] //
Map[Join[#, #] &] //
Map[Permutations] //
Flatten[#, 1] &