crosstabs
Function
crosstabs
function as a formatted table.
print.crosstabs(x, digits=2, marginal.totals=<<See below>>, chi2.test=T, ..., yates=F)
crosstabs
.
print
when it is
used to print components of the table.
x
.
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.
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 | # -------+-------+-------+