extractInfo: Extract information about a list object.

extractInfoR Documentation

Extract information about a list object.

Description

Extracts useful information such as the counts or the actual intersections between several sets.

Usage

extractInfo(
  x, what = c("counts", "intersections", "both"), use.names = FALSE
)

Arguments

x

A list object containing set elements, or a list of binary values

what

What to extract

use.names

Logical, use the set names to indicate intersections

Details

When the argument x is a list, the counts are taken from the number of common values for each intersection, and when x is a dataframe, (comprised of exclusively binary values 0 and 1) the counts are taken from the number of similar rows.

Value

A dataframe, when extracting the counts or a list if extracting intersections.

Examples


set.seed(12345)
xlist <- list(A = 1:20, B = 10:30, C = sample(25:50, 15))
xdf <- as.data.frame(matrix(
  sample(0:1, 90, replace = TRUE),
  ncol = 3
))
colnames(xdf) <- LETTERS[1:3]

extractInfo(xlist) # counts by default

extractInfo(xlist, what = "intersections")

extractInfo(xlist, what = "both")

extractInfo(xdf)


dusadrian/venn documentation built on Oct. 13, 2024, 5:41 p.m.