get_id: Access unique identifiers in epicontacts objects

Description Usage Arguments Value Author(s) Examples

View source: R/get_id.R

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

1
get_id(x, which = c("linelist", "contacts", "all", "common", "from", "to"))

Arguments

x

an epicontacts object

which

the type of ID to return (see description); value can be 'linelist', 'contacts', 'all', 'common', 'from' or 'to'.

Value

x a character vector of unique identifiers

Author(s)

Thibaut Jombart ([email protected])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

}

epicontacts documentation built on May 2, 2019, 11:29 a.m.