Learn R Programming

hypergea (version 0.99.4)

getMargins: Marginal sums of multidimensional contingency tables

Description

Calculates marginal sums for IxJ and IxJxK tables

Usage

getMargins(x)

Arguments

x
a table (matrix, array) without missing values

Value

  • A list of length length(dim(x)) containing the marginal sums of each dimension

Examples

Run this code
x <- matrix(c(1:4), nrow=2, ncol=2)
getMargins(x)

x <- matrix(c(1:6), nrow=2, ncol=3)
getMargins(x)

x <- array(c(1:8), dim=c(2,2,2))
getMargins(x)

Run the code above in your browser using DataLab