How can I select the duplicate values in a list?
Example:
{1, 2, 1, 1, 1, 1}
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHow can I select the duplicate values in a list?
Example:
{1, 2, 1, 1, 1, 1}
If you want all duplicates then:
list = {1, 2, 1, 1, 1, 1}
Select[Split@Sort@list, Length@# > 1 &]
if you want one from each duplicate then
Select[Split@Sort@list, Length@# > 1 &][[;;,1]]
{1}
. Please make an effort. $\endgroup$ – Öskå Jun 9 '14 at 15:17