margin.table: Compute table margin

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/table.R

Description

For a contingency table in array form, compute the sum of table entries for a given index.

Usage

1
margin.table(x, margin = NULL)

Arguments

x

an array

margin

index number (1 for rows, etc.)

Details

This is really just apply(x, margin, sum) packaged up for newbies, except that if margin has length zero you get sum(x).

Value

The relevant marginal table. The class of x is copied to the output table, except in the summation case.

Author(s)

Peter Dalgaard

See Also

prop.table and addmargins.

Examples

1
2
3
m <- matrix(1:4, 2)
margin.table(m, 1)
margin.table(m, 2)

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.