Software to Simplify Statistical Practice ...

Cross Tabulation - Example



Subjects were students in grades 4-6 from three school districts in Ingham and Clinton Counties, Michigan. Chase and Dummer stratified their sample, selecting students from urban, suburban, and rural school districts with approximately 1/3 of their sample coming from each district. Students indicated whether good grades, athletic ability, or popularity was most important to them. They also ranked four factors: grades, sports, looks, and money, in order of their importance for popularity. The questionnaire also asked for gender, grade level, and other demographic information.




  1. Open the DataBook PopularKid.vstz
    open this data file via the Help / Open Examples menu; it is in the Sample Data
  2. Choose the menu Analyze and the command CrossTabs, under group Data Summaries
  3. In Variables, select Gender, Grade and Urban/Rural
  4. Click OK




By default, R code is printed after parsing and before evaluation.
You can avoid this in File / Option / Advanced menu.

DataSheet is converted to DataFrame, in the form DataBook.DataSheet


> .Table <- xtabs(formula = ~Gender+Grade+Urban.Rural, data = PopularKids.children)
> .Table
, , Urban.Rural = Rural

Gender  4  5  6
  boy  16 24 26
  girl 28 29 26

, , Urban.Rural = Suburban

Gender  4  5  6
  boy  14 29 46
  girl  8 17 37

, , Urban.Rural = Urban

Gender  4  5  6
  boy  24 33 15
  girl 29 44 33

> remove(.Table)




In this layout, VisualStat creates a two-way table for each level of the layering variable, Urban/Rural. The row variable is Gender and the column variable is Grade. It may be easier for you to compare your data in a different layout. You can change your table layout by designating variables to be across rows, down columns, or as layers.