Learn R Programming

Rz (version 0.9-1)

crossTable: Cross Tabulation

Description

Output well-formatted cross tabulation. Also can genarate latex syntax of cross tabulation.

Usage

crossTable(..., deparse.level = 2) "summary"(object, digits=3, latex=FALSE, ...)

Arguments

deparse.level
passed to table
...
passed to table
object
crossTable object
digits
integer, used for number formatting
latex
logical, generate latex syntax if TRUE

Value

crossTable returns a object which belongs to CrossTable class and table class.

Examples

Run this code
sex    <- factor(rbinom(1:1000, 1, 0.5), labels=c("male" , "female"))
age    <- factor(rbinom(1:1000, 2, 0.4), labels=c("young", "middle", "old"))
weight <- factor(rbinom(1:1000, 2, 0.6), labels=c("light", "middle", "heavy"))

cross.table1 <- crossTable(sex, age)
summary(cross.table1)

cross.table2 <- crossTable(sex, age, weight)
summary(cross.table2)

summary(cross.table2, latex = TRUE)

Run the code above in your browser using DataLab