.BG
.VE $Header: /usr3/s/current/s/.help/RCS/tprint,v 1.3 83/12/30 19:36:02 rab Exp $
.FN tprint
.TL
tprint: Print Multi-way Tables
.CS
tprint(table1, table2, ..., Label=, maxcol=, mincol=)
.PP
.AG table
table or multi-way array.  Contingency tables may be
constructed (complete with `Label' component) from category
data by the `table' function.  If more than one table is
given, values from the tables are printed above one-another,
and the values are labelled by the table name, or by the
`name' used if `table' is given in `name=value' form.  All
tables must have the same dimensionality and number of
levels on each category (i.e., dimension of the tables).
Missing values (NAs) are allowed.
.AG Label=
optional structure containing as many components as there
are categories to the tables.  The name of each component is
the name used for the corresponding category, and each
component should be a character vector with as many values
as the number of levels of the category.  If any of the
tables already contain such a component named `Label', this
argument is not needed.
.AG maxcol=
optional, maximum category to be laid out across the page.
`tprint' displays the first category of the
tables down the page and the second across the page. If
there is enough room, categories 3, 4, ... will also be laid
out across the page. If `maxcol' is given this will be the
last category laid out this way, even if more would fit.
.AG mincol=
optional, minimum category to be laid out across the page.
Even if the category will not fit, `tprint' will lay it out
across the page, breaking the table into blocks if necessary.
By default, no category will be used across the page unless
all levels fit.
.EX
mydata <- table(age,sex,height,weight,eye.color)
tprint(mydata)    # print the table with labels for the levels
fitted <- loglin(mydata,model)    # fit log-linear model to table
        # three tables: data, fit, residuals for each cell
tprint(data=mydata,fit=fitted,residuals=mydata\-fitted)

# the example plot is produced by:
repair.1978 <- code( auto.stats[,3],
      1:5, c("Poor","Fair","Average","Good","Excellent")
      )
improved <- cut( auto.stats[,3]\-auto.stats[,4],
      c(\-100,\-.5,.5,100),c("Worse","Same","Better")
      )
price <- cut( auto.stats[,1],
      c(0,5000,8000,50000),c("Cheap","Mid","Expensive")
      )
tprint(table(repair.1978,improved,price))
.ft CW
.ps -2
.vs -2

price: Cheap
improved:      Worse    Same   Better
repair.1978:
  Poor           1       1       0
  Fair           0       3       0
  Average        0      12       3
  Good           0       2       2
  Excellent      0       2       3


price: Mid
improved:      Worse    Same   Better
repair.1978:
  Poor           0       0       0
  Fair           1       3       0
  Average        2       3       1
  Good           0       6       4
  Excellent      0       3       1


price: Expensive
improved:      Worse    Same   Better
repair.1978:
  Poor           0       0       0
  Fair           0       1       0
  Average        3       4       0
  Good           0       3       0
  Excellent      0       0       2


.ps +2
.vs +2
.ft 1
.KW printing
.KW contingency table
.KW category
.KW reports
.WR
