MathGroup Archive 2009

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

Search the Archive

Re: Counting Categories

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96870] Re: [mg96798] Counting Categories
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Thu, 26 Feb 2009 07:58:20 -0500 (EST)
  • References: <200902250903.EAA15666@smc.vnet.net> <49A568BC.4040207@wolfram.com>

Thank you, Darren.  I guess my only other question would be how to  
sort either the original data or the output so that it has the same  
ordering as the choices {red, blue, green}, {small, medium, big}.

Regards,

	Gregory

On Wed, Feb 25, 2009, at 10:50 AM, Darren Glosemeyer wrote:

> You mentioned Cases, but I think you meant Count. Tally will do the  
> counting you described.
>
> In[1]:= data = Transpose[{RandomChoice[{red, blue, green}, 20],
>          RandomChoice[{small, medium, big}, 20]}];
>
> In[2]:= Tally[data]
>
> Out[2]= {{{blue, medium}, 6}, {{green, medium}, 2}, {{red, medium},  
> 2}, {{green, small}, 5},
> >    {{blue, small}, 1}, {{red, small}, 2}, {{red, big}, 2}}
>
>
> Darren Glosemeyer
> Wolfram Research



  • Prev by Date: Re: Creating TOC with Mathematica 7
  • Next by Date: Re: Inverse of a Big Matrix
  • Previous by thread: Counting Categories
  • Next by thread: Re: Counting Categories