Displays a 2D crosstabulation with optional chi-squared test, odds ratio/relative risk and phi coefficient.
# S3 method for xtab
print(x,col.width=8,or=TRUE,chisq=TRUE,phi=TRUE,
rowname.width=NA,html=FALSE,bgcol="lightgray",...)
The list returned by calculate.xtab.
Width of the columns in the display.
whether to calculate the odds ratio and relative risk (only for 2x2 tables).
Whether to call chisq.test and display the result.
Whether to calculate and display the phi coefficient (only for 2x2 tables).
Optional width for the rownames. Mostly useful for truncating very long rownames.
Whether to format the table with HTML tags.
Background color for the table.
additional arguments passed to chisq.test.
nil
print.xtab displays a crosstabulation in a fairly conventional style with row, column and marginal percentages. If html is TRUE, the formatting will use HTML tags and will only be useful if viewed in an HTML browser. In order to get HTML formatting, save, the output of xtab and print with the argument html=TRUE.
If or is TRUE and the resulting table is 2x2, the odds ratio will be displayed below the table. If the function logical.names within print.xtab finds that the column margin names are one of FALSE/TRUE, 0/1 or NO/YES in those orders, the risk of the column variable for the second level of the row variable relative to the first row variable will be displayed as well.