collapse.cases {lca}R Documentation

Sum Identical Cases in a Frequency Table

Description

Given an object of class freq.table, identical cases are identified and their respective frequencies summed; the simplified table is returned.

An optional second argument allows a secondary table of counts to be collapsed according to the same pattern.

Usage

collapse.cases(x, y)

Arguments

x object of class freq.table to be collapsed.
y optional secondary table of counts.

Details

The function seeks identical cases in x, then simplifies by removing the duplication and summing the frequencies.

If an optional second arguement y is supplied, with number of rows equal to that of x, the function collapses it in the same pattern as x, summing all columns.

Value

A simplified table of counts.

If y is supplied, then a list with elements:
x simplified version of freq.table x.
y simplified version of y.

Author(s)

Robin Evans

See Also

group

Examples

data(small)

small = rbind(small, c(2,2,2,25))
y = matrix(c(12,52,9,29,42,93,49,1,9),9,1)
small
y
# Rows 1 and 9 are identical cases

collapse.cases(small, y)

[Package lca version 0.2 Index]