expand {epicalc}R Documentation

Expand an aggregated data frame

Description

Expand an 'aggregate'd data frame into a case-by-case format based on the values specified in a column

Usage

expand(aggregate.data, index.var = "Freq", retain.freq = FALSE)

Arguments

aggregate.data an aggregate data frame having a variable indicating the replication of subjects having that combination of characteristics, which are indicated by other variables
index.var name of a variable indicating frequency of replication
retain.freq whether the index variable or frequency variable should be retained in the returned data frame

Details

An aggregated data frame has one variable (colunm) indicating the number or frequency of replication of subjects having the same values of other variables as the index record.

'expand' replicates the row using the value in 'index.var' as the number of replications.

'retain.freq' indicates whether the 'index.var', which is the frequency, should be retained.

Note

The aggregated data frame is not changed. Remember to assign the result.

Author(s)

Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>

See Also

'table', 'xtabs', 'aggregate'

Examples

## Expanding an aggregated data frame
data(ANCtable)
des(ANCtable)
a <- expand(ANCtable)
des(a)

## Aggregating a case-by-case data frame
data(ANCdata)
use(ANCdata)
des()
id <- 1:nrow(ANCdata)
aggregate.numeric(id, by=list(Death=death, Anc=anc, Clinic=clinic), 
	FUN="count")

[Package epicalc version 2.10.1.1 Index]