This help topic is for R version 1.3. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/margin.table.html
margin.table {base}R Documentation

Compute table margin

Description

Compute the sum of table entries for a given index.

Usage

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.

Author(s)

Peter Dalgaard

Examples

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

[Package base version 1.3 ]