Skip to contents

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)

Arguments

x

List of vectors to perform intersections on

Value

data.table

a data.table containing columns for the sets being compared, a list column which contains the actual values in the intersection, and a column with the intersection size.

Examples

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

pairwise_intersections(l)
#>      Set1   Set2 Intersection Elements
#>    <char> <char>       <list>    <num>
#> 1:   Set1   Set2         B, C        2
#> 2:   Set1   Set3                     0
#> 3:   Set1   Set4      A, B, C        3
#> 4:   Set2   Set3                     0
#> 5:   Set2   Set4      B, C, D        3
#> 6:   Set3   Set4      X, Y, Z        3