| alignPair {dembase} | R Documentation |
Given an object of class DemographicArray, make dimensions with
dimtype "origin" and "destination" or "parent"
and "child" consistent. This is done by permuting and inserting rows.
alignPair( object, base = NULL, omitted = ifelse(methods::is(object, "Counts"), 0L, NA) ) ## S4 method for signature 'DemographicArray' alignPair( object, base = NULL, omitted = ifelse(methods::is(object, "Counts"), 0L, NA) )
object |
Object of class |
base |
Character vector giving the "base names" for the dimension pairs.
If |
omitted |
Value to be used for omitted origin-destination or parent-child
combinations. Defaults to |
The "base name" of a dimension with dimtype "origin",
"destination", "parent", or "child" is the name minus
the "_orig", "_dest", "_parent", or "_child"
suffix. For instance, the base name of "region_orig" and
"region_dest" is "region".
An object with the same class as object.
Function pairAligned tests whether a pair of dimensions
use the same categories in the same order.
x <- Counts(array(1:4,
dim = c(2, 2),
dimnames = list(region_orig = c("a", "b"),
region_dest = c("c", "b"))))
x
alignPair(x, base = "region")
alignPair(x)
alignPair(x, omitted = NA)
y <- Values(array(1:8,
dim = c(2, 2, 1, 2),
dimnames = list(region_orig = c("a", "b"),
region_dest = c("b", "a"),
ethnicity_parent = "q",
ethnicity_child = c("q", "r"))))
y
alignPair(y, base = "region")
alignPair(y, base = "ethnicity")
alignPair(y)