ID EN
Miscellaneous

prop.table

R Base 3.6.2

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).

Syntax

R
prop.table(x, margin = NULL)

Arguments

Parameter Description
x table
margin index, or vector of indices to generate margin for

Return Value

Table like x expressed relative to margin

Examples

Example
R
# NOT RUN {
m <- matrix(1:4, 2)
m
prop.table(m, 1)
# }

See Also

margin.table