get_degree: Find node degree for epicontacts objects

Description Usage Arguments Author(s) Examples

View source: R/get_degree.R

Description

This function computes the number of contacts per cases in a epicontacts dataset. Whenever contacts are directed, the argument 'type' can be used to specify which kind of contact should be considered: 'in' (towards the case), 'out' (from the case), or 'both'.

Usage

1
get_degree(x, type = c("in", "out", "both"), only_linelist = FALSE)

Arguments

x

an epicontacts object

type

the type of degree to be computed (see description); if contacts are not directed, this will be forced to 'both'

only_linelist

a logical indicating if cases whose degree is computed should be from the linelist exclusively

Author(s)

Thibaut Jombart ([email protected])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## make epicontacts object
if (require(outbreaks)) {
x <- make_epicontacts(ebola_sim$linelist, ebola_sim$contacts,
                       id="case_id", to="case_id", from="infector",
                       directed=TRUE)
x

## compute in-degree
deg_in <- get_degree(x)
table(deg_in)

## compute out-degree
deg_out <- get_degree(x, "out")
barplot(table(deg_out), main = "Reproduction number distribution")
mtext(side = 3, "(based on case out-degree)")

}

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