epicontacts

A collection of tools for representing epidemiological contact data, composed of case line lists and contacts between cases. Also contains procedures for data handling, interactive graphics, and statistics.

Installing the package

To install the current stable, CRAN version of the package, type:

install.packages("epicontacts")

To benefit from the latest features and bug fixes, install the development, github version of the package using:

devtools::install_github("reconhub/epicontacts")

Note that this requires the package devtools installed.

What does it do?

The main features of the package include:

epicontacts: a new S3 class for storing linelists and contacts data

make_epicontacts: a constructor for the new epicontacts class

get_id: access unique IDs in an epicontacts with various options

get_pairwise: extract attributes of record(s) in contacts database using
information provided in the linelist data of an epicontacts object.

get_degree: access degree of cases in epicontacts with various options

Getting help online

A quick overview

The following worked example provides a brief overview of the package’s
functionalities. See the vignettes section for more detailed
tutorials.

Obtaining an epicontacts object

epicontacts need two types of data:

a linelist, i.e. a spreadsheet documenting cases where columns are
variables and rows correspond to unique cases

a list of edges, defining connections between cases, identified by their
unique identifier

There does not need to be an one-to-one correspondance between cases documented
in the linelist and those appearing in the contacts. However, links will be made
between the two sources of data whenever unique identifiers match. This will be
especially handy when subsetting data, or when characterising contacts in terms
of ‘node’ (case) properties.

We illustrate the construction of an epicontacts using contact data from a
Middle East Respiratory Syndrom coronavirus (MERS CoV) from South Korea in 2015,
available as the dataset mers_korea_2015 in the package outbreaks.

In practice, the linelist and contacts will usually be imported from a text file
(e.g. .txt, .csv) or a spreadsheet (e.g. .ods, .xls) using usual import
functions (e.g. read.table, read.csv, gdata::read.xls).

There is no obvious signs of non-random mixing patterns, but this is worth
testing. The function get_pairwise is particularly useful for this. In its
basic form, it reports nodes of attributes for all contacts. For instance:

Indeed, there are no patterns of association between genders. We can also use
this function to compute delays between dates. For instance, to get the
distribution of the serial interval (delay between primary and secondary onset):