xtabs
xtabs is a base R function that creates contingency tables from a formula and a data frame. It builds cross-tabulations of one or more factors and returns the result as an array (class "table"). The function is especially convenient for turning data with a frequency column into multi-dimensional tables or for generating tables directly from a formula interface.
The typical usage uses a formula to specify the variables that define the table. The right-hand side
Return value and handling: xtabs returns an array with dimensions corresponding to the levels of the involved
Related concepts: xtabs is related to table and ftable, and can be used in conjunction with functions