margin.table

0th

Percentile

Compute table margin

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

Keywords
array
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. The class of x is copied to the output table, except in the summation case.

See Also

prop.table and addmargins.

Aliases
  • margin.table
Examples
library(base) # NOT RUN { m <- matrix(1:4, 2) margin.table(m, 1) margin.table(m, 2) # }
Documentation reproduced from package base, version 3.5.1, License: Part of R 3.5.1

Community examples

Looks like there are no examples yet.