Consolidate two group identifiers.
merge_ids(...)
# S3 method for default
merge_ids(id1, id2, tie_sort = NULL, expand = TRUE, shrink = FALSE, ...)
# S3 method for pid
merge_ids(id1, id2, tie_sort = NULL, expand = TRUE, shrink = FALSE, ...)
# S3 method for epid
merge_ids(id1, id2, tie_sort = NULL, expand = TRUE, shrink = FALSE, ...)
# S3 method for pane
merge_ids(id1, id2, tie_sort = NULL, expand = TRUE, shrink = FALSE, ...)
Other arguments
[atomic]
. Preferential order for breaking tied matches.
[logical]
. If TRUE
, id1
gains new records if id2
indicates a match. Not interchangeable with shrink
.
[logical]
. If TRUE
, id1
loses existing records id2
does not indicate a match. Not interchangeable with expand
.
Groups in id1
are expanded or shrunk by groups in id2
.
A unique group with only one record is considered a non-matching record.
Note that the expand
and shrink
features are not interchangeable.
The outcome when shrink
is TRUE
is not the same when expand
is FALSE
.
See Examples
.
id1 <- rep(1, 5)
id2 <- c(2, 2, 3, 3, 3)
merge_ids(id1, id2, shrink = TRUE)
#> [1] 1 1 1 1 1
id1 <- c(rep(1, 3), 6, 7)
id2 <- c(2,2,3,3,3)
merge_ids(id1, id2, shrink = TRUE)
#> [1] 1 1 3 4 5
merge_ids(id1, id2, expand = FALSE)
#> [1] 1 1 1 4 4
id1 <- rep(1, 5)
id2 <- c(1:3, 4, 4)
merge_ids(id1, id2, shrink = TRUE)
#> [1] 1 1 1 4 4
merge_ids(id1, id2, expand= FALSE)
#> [1] 1 1 1 1 1
data(missing_staff_id)
dfr <- missing_staff_id
id1 <- links(dfr[[5]])
id2 <- links(dfr[[6]])
merge_ids(id1, id2)
#> [1] "P.1 (CRI 001)" "P.4 (CRI 002)" "P.3 (No hits)" "P.4 (CRI 001)"
#> [5] "P.4 (CRI 001)" "P.6 (No hits)" "P.1 (CRI 001)"