marginSums Compute table margins
 Description
For a contingency table in array form, compute the sum of table entries for a given margin or set of margins.
Usage
marginSums(x, margin = NULL) margin.table(x, margin = NULL)
Arguments
| x | an array | 
| margin | a vector giving the margins to compute sums for. E.g., for a matrix  | 
Value
The relevant marginal table, or just the sum of all entries if margin has length zero. The class of x is copied to the output table if margin is non-NULL. 
Note
margin.table is an earlier name, retained for back-compatibility.
Author(s)
Peter Dalgaard
See Also
proportions and addmargins. 
Examples
m <- matrix(1:4, 2) marginSums(m, 1) marginSums(m, 2) DF <- as.data.frame(UCBAdmissions) tbl <- xtabs(Freq ~ Gender + Admit, DF) marginSums(tbl, "Gender") proportions(tbl, "Gender")
    Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.