margin.table {base} | R Documentation |
Compute the sum of table entries over a given index.
margin.table(x, margin)
x |
an array |
margin |
index number (1 for rows, etc.) |
This is really just apply(x,margin,sum)
packaged up for newbies.
The relevant marginal table.
Peter Dalgaard
m<-matrix(1:4,2) margin.table(m,1) margin.table(m,2)