knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width=8,
  fig.height=6,
  fig.path="figs/",
  echo = TRUE
)

Welcome to the epicontacts package!


Travis-CI Build Status Build status Coverage Status CRAN_Status_Badge CRAN Downloads Downloads from Rstudio mirror


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:

Resources

Vignettes

An overview of epicontacts is provided below in the worked example below. More detailed tutorials are distributed as vignettes with the package:

vignette("overview", package="epicontacts")
vignette("customize_plot", package="epicontacts")
vignette("epicontacts_class", package="epicontacts")

Websites

The following websites are available:

Getting help online

Bug reports and feature requests should be posted on github using the issue system. All other questions should be posted on the RECON forum:
http://www.repidemicsconsortium.org/forum/

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:

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.

library(outbreaks)
library(epicontacts)

names(mers_korea_2015)
dim(mers_korea_2015$linelist) 
dim(mers_korea_2015$contacts) 

x <- make_epicontacts(linelist = mers_korea_2015$linelist,
                      contacts = mers_korea_2015$contacts, 
                      directed = TRUE)
x
class(x)
summary(x)

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

Simple analyses

First, we plot the epicontacts object:

plot(x, selector = FALSE)

This is a screenshot of the actual plot. For interactive graphs, see the introductory vignette.

We can look for patterns of contacts between genders:

plot(x, "sex", col_pal = spectral)

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:

get_pairwise(x, attribute = "sex")

However, one can specify the function to be used to compare the attributes of connected nodes; for instance:

sex_tab <- get_pairwise(x, attribute = "sex", f = table)
sex_tab
fisher.test(sex_tab)

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

si <- get_pairwise(x, attribute = "dt_onset")
si
summary(si)
hist(si, col = "grey", border = "white", nclass = 30, 
     xlab = "Time to secondary onset (days)", 
     main = "Distribution of the serial interval")

Contributors (by alphabetic order):

See details of contributions on:
https://github.com/reconhub/epicontacts/graphs/contributors

Contributions are welcome via pull requests.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Maintainer: Finlay Campbell (finlaycampbell93@gmail.com)



reconhub/epicontacts documentation built on Feb. 28, 2024, 3:15 p.m.