make_epicontacts {epicontacts}R Documentation

Read linelist and contact data

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

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 (thibautjombart@gmail.com)

Examples

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)
}

[Package epicontacts version 1.1.4 Index]