Learn R Programming

mosaic (version 0.4-1)

perctable: Cross tabulation displayed as percents or proportions

Description

perctable and proptable use the cross-classifying factors to build a contingency table of the percents or proportions at each combination of factor levels.

Usage

perctable(...)

proptable(...)

Arguments

...
arguments passed directly to table; typically one or more objects which can be interpreted as factors (including character strings), or a list (or data frame) whose components can be so interpreted.

Value

  • a contingency table, an object of class "table", an array of percentage or proportion values. Note that unlike S the result is always an array, a 1D array if one factor is given.

Details

See table.

Examples

Run this code
perctable(rbinom(1000,10,.5))
with(airquality,
   perctable(OzHi=Ozone > 80, Month, useNA="ifany"))
with(airquality,
   perctable(OzHi=Ozone > 80, Month, useNA="always"))

Run the code above in your browser using DataLab