Is there a way to write a function where the input is a vector and the output is the elements in the vector that are repeated?
I was trying to use something along the lines:
f[x_] := DeleteCases[Gather[x], Length[#1] != 1]
Of course this doesn't work, giving me this output:
input: f[{1, 2, 2, 1, 4, 3, 5, 5, 2, 7, 8, 9, 0, 11}]
output: {{1, 1}, {2, 2, 2}, {4}, {3}, {5, 5}, {7}, {8}, {9}, {0}, {11}}
If I was able to delete the elements with Length 1, I could delete easily construct the output
f[x_] := Select[Gather[x], Length[#] != 1 &][[All, 1]]
. $\endgroup$