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

Description Usage Arguments Details Value See Also Examples

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

1
2
3
4
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

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

StatisticsNZ/dembase documentation built on Dec. 25, 2021, 4:49 p.m.