summarize_binary_clusters: Summarize binary covariate clusters

Description Usage Arguments Details Value Examples

View source: R/summarize_binary_covariate_clusters.R

Description

Summarize binary covariate clusters

Usage

1
summarize_binary_clusters(df, covariate_name = "x")

Arguments

df

data frame with the following columns

cluster_id

unique cluster ID

covariate_name

actual name of feature to summarize over, a binary (0/1) covariate

covariate_name

name of the single binary covariate

Details

Condense data from data frames about each individuals to the summary of the number of indivduals who have a particular covariate feature (1/0). This assumes the trees are in order by generation.

Value

a data frame with the following columns

freq

frequency of the following clusters

cluster_size

total size of the cluster

x_pos

number of individuals in the cluster with the feature of interest =1

x_neg

number of individuals in the cluster with the feature of interest = 0

Examples

1
2
3
4
5
6
7
8
9
example_cluster <- data.frame(cluster_id = c(1, 1, 1,
2, 2,
3, 3, 3, 3,
4),
x = c(0, 1, 1,
0, 0,
1, 0, 1, 1,
0))
summarize_binary_clusters(example_cluster)

skgallagher/InfectionTrees documentation built on July 28, 2021, 2:14 p.m.