Selection and Counting

This is the trickiest part.  From the survey matrix, select those rows where the first column is "m" or "f".

In[51]:=

men = Select[survey, #[[1]] == "m"&] ; women = Select[survey, #[[1]] == "f"&] ;

In[36]:=

men//MatrixForm

In[79]:=

women//MatrixForm

Then extract the 3rd column from each of those matrices.

In[53]:=

mensHeights = Column[men, 3] ; womensHeights = Column[women, 3] ;

In[48]:=

mensHeights

Out[48]=

RowBox[{{, RowBox[{71, ,, 70, ,, 69, ,, 78, ,, 72, ,, 71, ,, 74, ,, 71, ,, 68, ,, 71, ,, 71, , ... , 69.75, ,, 73, ,, 79, ,, 64, ,, 68, ,, 72, ,, 72, ,, 70, ,, 72, ,, 74, ,, 69, ,, 73, ,, 65}], }}]

In[55]:=

womensHeights

Out[55]=

RowBox[{{, RowBox[{62, ,, 66, ,, 66, ,, 60, ,, 65.5, ,, 66, ,, 64, ,, 66, ,, 64, ,, 63, ,, 61, ... , ,, 64, ,, 69, ,, 67, ,, 67, ,, 63, ,, 64, ,, 63, ,, 69, ,, 72, ,, 49, ,, 65, ,, 60, ,, 66}], }}]

Count the number in each bin from 48 to 80 with spacing 1.

In[57]:=

mensCounts = BinCounts[mensHeights, {48, 80, 1}]

Out[57]=

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 3, 5, 5, 9, 6, 3, 3, 1, 0, 0, 1, 1, 0}

In[58]:=

womensCounts = BinCounts[womensHeights, {48, 80, 1}]

Out[58]=

{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 4, 4, 7, 3, 12, 5, 2, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}


Created by Mathematica  (September 23, 2003)