Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2009

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

Search the Archive

Counting Categories

  • To: mathgroup at
  • Subject: [mg96798] Counting Categories
  • From: Gregory Lypny <gregory.lypny at>
  • Date: Wed, 25 Feb 2009 04:03:33 -0500 (EST)

Hello Everyone,

I'm trying to do multivariate category counts in the way that used to  
be handled by CategoryCounts but is now replaced by Cases.  The  
example in Help simply applies Cases twice to find the count of  
elements in a list that are numbers and the count that is even.

Map[Cases[{a, b, c, 1, 2, d, 3}, #] &, {_?NumberQ, _?EvenQ}]

{{1, 2, 3}, {2}}

But what if I have many rows of observations on two dimensions  
(columns) such as red, blue, green, and small, medium, big?  I'd like  
to be able categorize them accordingly as the count of small and red,  
medium and red, big and red, and so on.  Any way to do that?



  • Prev by Date: HoldForm[1*2*3] should give 1 x 2 x 3 not 2 x 3
  • Next by Date: N00b help needed: Graphics
  • Previous by thread: Re: HoldForm[1*2*3] should give 1 x 2 x 3 not 2 x 3
  • Next by thread: Re: Counting Categories