Frequency distributions (univariate and joint) can be displayed in contingency tables, or cross-tabulations. In this video we show how tapply() can be used to create such tables, but we also introduce the table(), ftable(), and xtabs() functions,
which are specifically designed for the task. These functions have a simpler syntax for table construction than tapply() and produce objects of class "table", which can be fed into other functions that are designed to operate on tabular data.
Whereas table() and xtabs() produce results that are printed out in a manner similar to an array, ftable() produces a "flat table" that is generally easier to read for 3- and higher-way tables. xtabs() has a formula-based syntax and can create
tables from both grouped and ungrouped data.This video illustrates all four of these functions for constructing tables in R.
This topic is important and this video is essential viewing for the course.