pairwise_intersections: Get unique pairwise intersections of a list of vectors

View source: R/utils.R

pairwise_intersectionsR Documentation

Get unique pairwise intersections of a list of vectors

Description

This function takes in a list of vectors and performs pairwise set intersections for all unique pairs of vectors in the list.

Usage

pairwise_intersections(x, universe_size = NULL)

Arguments

x

List of vectors to perform intersections on

universe_size

Size of the universe of features each set was drawn from. default NULL. If supplied then a fisher's exact test is performed to assess the significance of the overlap. Note, the same universe size is used for all pairwise comparisons.

Value

data.table

a data.table containing columns for the sets being compared, a list column which contains the actual values in the intersection, a column with the intersection size, and a column with the Jaccard index, and optionally a P-Value column containing the p-value from a fisher's exact test if universe_size is given.

Examples

l <- list(
  Set1 = c("A", "B", "C"), 
  Set2 = c("B", "C", "D"),
  Set3 = c("X", "Y", "Z"),
  Set4 = LETTERS
)

pairwise_intersections(l)

jcalendo/coriell documentation built on March 5, 2025, 5:42 a.m.