Description Usage Arguments Details Value Author(s) See Also Examples
For a contingency table in array form, compute the sum of table entries for a given index.
1 | margin.table(x, margin = NULL)
|
x |
an array |
margin |
index number (1 for rows, etc.) |
This is really just apply(x, margin, sum)
packaged up for
newbies, except that if margin
has length zero you get
sum(x)
.
The relevant marginal table. The class of x
is copied to the
output table, except in the summation case.
Peter Dalgaard
prop.table
and addmargins
.
1 2 3 | m <- matrix(1:4, 2)
margin.table(m, 1)
margin.table(m, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.