make_epicontacts: Read linelist and contact data

Description Usage Arguments Details Value Author(s) References Examples

View source: R/make_epicontacts.R

Description

This function reads data stored as data.frame containing linelist (case information, where each row corresponds to a unique patient), and contacts between patients. Common identifiers should be used in the two data sources for matching to be achieved.

Usage

1
2
make_epicontacts(linelist, contacts, id = 1L, from = 1L, to = 2L,
  directed = FALSE)

Arguments

linelist

a data.frame with at least one column providing unique patient identifiers

contacts

a data.frame that needs at least two columns indicating patients between which cases take place; these need not be referenced in the linelist

id

an index or name indicating which column in linelist contains unique identifiers; default is first column in linelist data frame

from

an index or name indicating which column in contacts contains the first case of a contact

to

an index or name indicating which column in contacts contains the second case of a contact

directed

a logical indicating if contacts are directed or not; default is FALSE but note that contacts will be indicated as 'from' and 'to' even in non-directed contacts

Details

An epicontacts object can be created from two components:

Value

An epicontacts object in list format with three elements:

Author(s)

Thibaut Jombart ([email protected])

References

http://foodborne.unl.edu/public/role/epidemiologist/lineLists.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
if (require(outbreaks)) {
## make epicontacts object from simulated Ebola data
x <- make_epicontacts(ebola_sim$linelist, ebola_sim$contacts)

## test reordering of columns
linelist <- ebola_sim$linelist[,rev(seq_len(ncol(ebola_sim$linelist)))]
contacts <- ebola_sim$contacts[,rev(seq_len(ncol(ebola_sim$contacts)))]
head(linelist)
head(contacts)

## make object
x <- make_epicontacts(linelist, contacts, id = "case_id",
                       to = "case_id", from = "infector")
head(x$linelist)
head(x$contacts)
}

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