chain: Chain concordances.

Description Usage Arguments Details Value See Also Examples

View source: R/miscellaneous-functions.R

Description

Combine two or more concordances to form a new concordance via a merge-like operation. For instance, if x is a concordance between classification c1 and classification c2, and y is a concordance between c2 and c3, then chain(x, y) creates a concordance between c1 and c3.

Usage

1

Arguments

...

Objects of class Concordance.

Details

Two concordances that are to be chained together must have a classification in common. In addition, the two versions of the common classification must have the same set of values, though not necessarily in the same order. Concordances are merged from left to right.

Value

An object of class Concordance.

See Also

splice combines concordances via a rbind-like operation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
x <- cbind(c1 = c("a", "b", "c"), c2 = c("e", "f", "f"))
x <- Concordance(x)
y <- cbind(c2 = c("e", "f"), c3 = c("i", "j"))
y <- Concordance(y)
z <- cbind(c3 = c("i", "j"), c4 = c("m", "l"))
z <- Concordance(z)
x
y
z
chain(x, y)
chain(x, y, z)

x <- cbind(c1 = c("a", "b"), c2 = c("e", "f"))
x <- Concordance(x)
y <- cbind(c3 = c("i", "j"), c2 = c("e", "f"))
y <- Concordance(y)
z <- cbind(c3 = c("i", "j", "k"), c2 = c("e", "e", "f"))
z <- Concordance(z)
x
y
z
## The order of the columns is irrelevant in a "OneToOne" object
chain(x, y)
## ...but not a "ManyToOne" object
## Not run: chain(x, z)

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