Learn R Programming

usefun (version 0.5.2)

powerset_icounts: 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)

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

Arguments

ids

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

Examples

Run this code
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))

Run the code above in your browser using DataLab