Re: Occurrences in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg106367] Re: [mg106350] Occurrences in Mathematica
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 11 Jan 2010 05:26:57 -0500 (EST)
- Reply-to: hanlonr at cox.net
data = RandomInteger[{0, 9}, 20] {5,5,9,2,6,5,3,9,1,6,1,0,9,6,4,5,8,6,7,5} Select[Union[data], Count[data, #] == 1 &] {0,2,3,4,7,8} Cases[Union[data], _?(Count[data, #] == 1 &)] {0,2,3,4,7,8} DeleteCases[Union[data], _?(Count[data, #] > 1 &)] {0,2,3,4,7,8} Cases[{#, Count[data, #]} & /@ Union[data], {x_, 1} -> x] {0,2,3,4,7,8} Bob Hanlon ---- George <gtatishvili at gmail.com> wrote: ============= Hi, I have a very big list of elements and I need Mathematica to give me only those elements which occure only once... Could anybody advise me please how to write the code for that? Thks much George