subset_clusters_by_size: Subset clusters from epicontacts object by cluster size

Description Usage Arguments Value Author(s) Examples

View source: R/subset_clusters_by_size.R

Description

This function subsets an epicontacts object based on defined size(s) of clusters (clusters being groups of connected individuals/nodes). Subsetting may be done by specifying a particular cluster size of interest, minimum cluster size, maximum cluster size, or a range (minimum and maximum) of cluster sizes.

Usage

1
subset_clusters_by_size(x, cs = NULL, cs_min = NULL, cs_max = NULL)

Arguments

x

an epicontacts object

cs

cluster size to be used for subsetting

cs_min

minimum cluster size for subsetting

cs_max

maximum cluster size for subsetting

Value

An epicontacts object whose contact dataframe corresponds to all clusters of specified cluster sizes.

Author(s)

Nistara Randhawa ([email protected])

Examples

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


## subset based on cluster size range
x_subset <- subset_clusters_by_size(x, cs_min = 12, cs_max = 15)


## subset based on single cluster size
x_subset <- subset_clusters_by_size(x, cs = 12)


## subset based on minimum cluster size
x_subset <- subset_clusters_by_size(x, cs_min = 10)


## subset based on maximum cluster size
x_subset <- subset_clusters_by_size(x, cs_max = 9)
}

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