get_id {epicontacts} | R Documentation |
Access unique identifiers in epicontacts objects
Description
This accessor is used to extract unique identifiers from
epicontacts
objects. The argument 'which' can be used to
specify if IDs should include: linelist only ('linelist'), contacts only
('contacts'), the union of both ('all'), or the intersection of both
('common'); two additional options are 'from' (ID 'giving' contacts) and 'to'
(ID 'receiving' contacts).
Usage
get_id(
x,
which = c("linelist", "contacts", "all", "common", "from", "to"),
na.rm = TRUE
)
Arguments
x |
an |
which |
the type of ID to return (see description); value can be 'linelist', 'contacts', 'all', 'common', 'from' or 'to'. |
na.rm |
a 'logical' indicating if 'NA' should be removed from the output ('TRUE', default) or not. |
Value
x a character vector of unique identifiers
Author(s)
Thibaut Jombart (thibautjombart@gmail.com)
Examples
if (require(outbreaks)) {
## build data
x <- make_epicontacts(ebola_sim$linelist, ebola_sim$contacts,
id="case_id", to="case_id", from="infector",
directed=TRUE)
## get identifiers
id1 <- get_id(x, "linelist")
id2 <- get_id(x, "contacts")
id3 <- get_id(x, "all")
id4 <- get_id(x, "common")
## check intersections and unions
all.equal(union(id1, id2), id3)
all.equal(intersect(id1, id2), id4)
}
[Package epicontacts version 1.1.4 Index]