pairToState: Convert dimensions with paired dimtypes to state dimtypes

Description Usage Arguments Value See Also Examples

Description

dimtypes "origin" and "destination", and dimtypes "parent" and "child", always come in pairs. If one of these dimensions is collapsed, the remaining dimension is converted to dimtype "state", and the "_orig", "_dest", "_parent" or "_child" suffix in its name disappears. Normally this behaviour is useful, but sometimes it is not. pairToState converts all dimensions in object with dimtype "origin", "destination", "parent", or "child" to dimtype "state". To conform to the rule that paired dimensions, and only paired dimensions, have suffixes code"_orig", "_dest", "_parent" or "_child", the names of transformed dimensions are changed, with the "_" characters in the suffixes being changed to ".".

Usage

1
2
3
4
pairToState(object)

## S4 method for signature 'DemographicArray'
pairToState(object)

Arguments

object

An object of class DemographicArray.

Value

An object with the same class as object, but with altered dimtypes and names, if any paired dimtypes were present in object.

See Also

For descriptions of dimtypes and the rules that govern them, see dimtypes. Dimensions are collapsed using function collapseDimension.

Examples

1
2
3
4
5
6
x <- Counts(array(1:9,
                  dim = c(3, 3),
                  dimnames = list(region_orig = c("A", "B", "C"),
                                  region_dest = c("A", "B", "C"))))
x
pairToState(x)

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