MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Occurrences in Mathematica


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




  • Prev by Date: How to Modify Mathematica 7 Documentation Center Default Styles
  • Next by Date: Re: Occurrences in Mathematica
  • Previous by thread: Re: Occurrences in Mathematica
  • Next by thread: Re: Occurrences in Mathematica