prop.table

0th

Percentile

Express Table Entries as Fraction of Marginal Table

This is really sweep(x, margin, margin.table(x, margin), "/") for newbies, except that if margin has length zero, then one gets x/sum(x).

Keywords
array
Usage
prop.table(x, margin = NULL)
Arguments
x
table
margin
index, or vector of indices to generate margin for
Value

Table like x expressed relative to margin

See Also

margin.table

Aliases
  • prop.table
Examples
library(base) m <- matrix(1:4, 2) m prop.table(m, 1)
Documentation reproduced from package base, version 3.1.3, License: Part of R 3.1.3

Community examples

nitinpango@gmail.com at Jan 5, 2018 base v3.4.3

#column wise prop.table(table(mtcars$am, mtcars$carb), margin=2)