Description Usage Arguments Details Value See Also Examples
Dimensions with dimtypes
"origin"
and
"destination"
or "parent"
and "child"
come in pairs.
pairAligned
tests whether the members of each pair have
the same categories, in the same order. If they do, pairAligned
returns TRUE
. If not, it raises an error with a message that
describes the differences.
1 2 3 4 5 6 7 | pairAligned(object, base = NULL)
## S4 method for signature 'DemographicArray'
pairAligned(object, base = NULL)
## S4 method for signature 'MetaData'
pairAligned(object, base = NULL)
|
object |
An object of class |
base |
Character vector giving the "base names" for the dimension pairs.
If |
By default pairAligned
tests all origin-destination and
parent-child pairs. Argument base
can be used to restrict
the test to specific pairs. See below for an example.
TRUE
or an error describing any differences.
Pairs of dimensions can be aligned using function
alignPair
. In programming, functions try
and
tryCatch
may be useful for intercepting and dealing with
errors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | x <- Counts(array(1:4,
dim = c(2, 2),
dimnames = list(reg_orig = c("A", "B"),
reg_dest = c("A", "B"))))
pairAligned(x)
x <- Counts(array(1:6,
dim = 3:2,
dimnames = list(reg_orig = c("A", "B", "C"),
reg_dest = c("A", "B"))))
## Not run: pairAligned(x)
## first pair not aligned; second pair OK
x <- Counts(array(1:16,
dim = c(2, 2, 2, 2),
dimnames = list(reg_orig = c("B", "A"),
reg_dest = c("A", "B"),
income_parent = c("Low", "High"),
income_child = c("Low", "High"))))
## Not run: pairAligned(x)
pairAligned(x, base = "income")
## Not run: pairAligned(x, base = "reg")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.