Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use the mosaic() function from
the vcd package. For this example we’ll use the USBAdmissions data set, which is a contingency
table with three dimensions. We’ll first take a look at the data in a
few different ways:
UCBAdmissions,,Dept=A Gender Admit Male Female Admitted51289Rejected31319...[four other Depts],,Dept=FGender Admit Male Female Admitted2224Rejected351317# Print a "flat" contingency tableftable(UCBAdmissions)Dept A B C D EdimnamesFAdmit Gender Admitted Male5123531201385322Female89172021319424Rejected Male313207205279138351Female198391244299317(UCBAdmissions)$Admit[1]"Admitted""Rejected"$Gender[1]"Male""Female"$Dept[1]"A""B""C""D""E""F"