get_pairwise: Characterise contacts by comparing case attributes

Description Usage Arguments Author(s) Examples

View source: R/get_pairwise.R

Description

This function extract attributes of cases involved in contacts using case information provided in the linelist of an epicontacts dataset. If not provided, the function used to process attributes will adjust to the type of attribute selected (see details).

Usage

1
get_pairwise(x, attribute, f = NULL, hard_NA = TRUE)

Arguments

x

an epicontacts object

attribute

the attribute to be examined between contact pairs

f

a function processing the attributes of 'from' and 'to'

hard_NA

a logical indicating if the output should be NA whenever one of the paired values is NA (TRUE, default); otherwise, 'NA' may be treated as another character (e.g. when pasting paired values)

Author(s)

Thibaut Jombart ([email protected]) Tom Crellen ([email protected])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (require(outbreaks)) {
## example using MERS outbreak in Korea, 2014
head(mers_korea_2015[[1]])
head(mers_korea_2015[[2]])

x <- make_epicontacts(linelist=mers_korea_2015[[1]],
contacts=mers_korea_2015[[2]], directed=TRUE)

## estimate serial interval (onset->onset)
SI <- get_pairwise(x, "dt_onset")
SI
summary(SI)
hist(SI, col="grey", border="white", xlab="Days after symptoms",
     main="MERS Korea 2014 - Serial Interval")

## check gender mixing:
get_pairwise(x, "sex") # not good, we want 2-way table

get_pairwise(x, "sex", f=table) # use custom function
fisher.test(get_pairwise(x, "sex", f=table)) # test association
}

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