Print Output of crosstabs Function

DESCRIPTION:

Print output of crosstabs function as a formatted table.

USAGE:

print.crosstabs(x, digits=2, marginal.totals=<<See below>>,
                chi2.test=T, ..., yates=F)

REQUIRED ARGUMENTS:

x
output of crosstabs.

OPTIONAL ARGUMENTS:

digits
number of digits after the decimal point to use when displaying the proportions in the crosstabs tables.
marginal.totals
logical value; if TRUE (the default if the table has more than one dimension), print the row and column totals for each 2 dimensional layer of the table along side the layer. Also print the layer total and the proportion each row and column is of the layer total.
chi2.test
logical value; if TRUE (the default if the table has more than one dimension), print the result of the chi-squared test for independence of all the variables in the table. Yates' correction is not used.
yates
If FALSE (the default) not not apply Yates' continuity correction when computing the chi-squared statistic. If TRUE do apply the correction.
...
Any other arguments will be passed onto print when it is used to print components of the table.

VALUE:

returns the input x.

SIDE EFFECTS:

Prints a crosstabs table.

DETAILS:

The function is generally not explicitly called, but is invoked as a side effect of executing the crosstabs function and letting the automatic printing work. You may call it explicitly to get more control over the formatting of the table.

SEE ALSO:

.

EXAMPLES:

petfood <- data.frame(Pet=c("Dog","Dog","Cat","Cat","Cat"),
                   Food=c("Wet","Dry","Dry","Dry","Dry"))
tmp <- crosstabs(~Pet+Food, data=petfood)
print(tmp, marginal.totals=F, chi2.test=F)
# Produces the following output:
#   Call:
#   crosstabs( ~ Pet + Food, data = petfood)
#   5 cases in table
#   +----------+
#   |N         |
#   |N/RowTotal|
#   |N/ColTotal|
#   |N/Total   |
#   +----------+
#   Pet    |Food
#          |Dry    |Wet    |
#   -------+-------+-------+
#   Cat    |3      |0      |
#          |1.00   |0.00   |
#          |0.75   |0.00   |
#          |0.60   |0.00   |
#   -------+-------+-------+
#   Dog    |1      |1      |
#          |0.50   |0.50   |
#          |0.25   |1.00   |
#          |0.20   |0.20   |
#   -------+-------+-------+