powerset_icounts: Powerset Intersection Table

View source: R/intersection_powerset.R

powerset_icountsR Documentation

Powerset Intersection Table

Description

This function computes the intersection of elements for all possible combinations of the provided sets of IDs. A typical use case is in a cohort of patients with incomplete data across multiple data types. This function helps determine how many patients have complete data for specific combinations of data types, allowing you to find the optimal combinations for analysis.

Usage

powerset_icounts(ids)

Arguments

ids

list()
A named list, each element being a numeric vector of ids.

Value

A tibble with columns:

  • set_combo: name for combo set/vector

  • num_subsets: number of subsets in the combo set

  • common_ids: vector of common ids in the combo set

  • count: number of common ids

Examples

library(dplyr)
ids = list(a = 1:3, b = 2:5, c = 1:4, d = 3:6, e = 2:6)
res = powerset_icounts(ids)

res |>
  filter(num_subsets >= 2, count > 2) |>
  arrange(desc(count), desc(num_subsets))


usefun documentation built on Sept. 15, 2024, 1:06 a.m.