addPair {dembase}R Documentation

Add a "destination" or "child" dimension to an object.

Description

Add a dimension with dimtype "destination" or "child" to an object of class DemographicArray. This is useful mainly when constructing an exposure measure to use when measuring or modelling origin-destination or parent-child rates.

Usage

addPair(object, base, dimtype = c("destination", "child"))

## S4 method for signature 'Counts'
addPair(object, base, dimtype = c("destination", "child"))

Arguments

object

An object of class DemographicArray.

base

The name of an existing dimension. This dimension must have dimtype "state" or "sex".

dimtype

Either "destination" (the default) or "child".

Details

The new dimension uses the same categories as one of the existing dimensions, which becomes the "origin" or "parent" dimension. The original data is replicated once for each category within the new dimension. This means that in a model of origin-destination rates, each destination has the same exposures, and in a model or parent-child rates each child category has the same exposures.

Value

A modified version of object

See Also

To add a dimension that does not have dimtype "destination", or "child", use function addDimension.

Examples

population <- CountsOne(10:12, labels = c("A", "B", "C"), name = "region")
addPair(population, base = "region")
addPair(population, base = "region", dimtype = "child")

[Package dembase version 0.0.0.119 Index]