list_to_matrix: Convert a List of Sets to a Binary Matrix

Description Usage Arguments Details Examples

View source: R/Upset.R

Description

Convert a List of Sets to a Binary Matrix

Usage

1
list_to_matrix(lt, universal_set = NULL)

Arguments

lt

A list of vectors.

universal_set

The universal set.

Details

It converts the list which have m sets to a binary matrix with n rows and m columns where n is the size of universal set.

Examples

1
2
3
4
5
6
set.seed(123)
lt = list(a = sample(letters, 5),
          b = sample(letters, 10),
          c = sample(letters, 15))
list_to_matrix(lt)
list_to_matrix(lt, universal_set = letters)

Example output

Loading required package: grid
========================================
ComplexHeatmap version 2.6.2
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

  a b c
c 1 1 0
d 0 0 1
e 0 1 1
g 0 0 1
h 0 0 1
i 0 1 1
j 1 0 1
k 0 1 1
l 0 0 1
m 0 0 1
n 1 1 1
o 1 0 0
q 0 0 1
r 0 1 0
s 1 1 1
t 0 1 0
v 0 1 1
w 0 1 0
x 0 0 1
y 0 0 1
  a b c
a 0 0 0
b 0 0 0
c 1 1 0
d 0 0 1
e 0 1 1
f 0 0 0
g 0 0 1
h 0 0 1
i 0 1 1
j 1 0 1
k 0 1 1
l 0 0 1
m 0 0 1
n 1 1 1
o 1 0 0
p 0 0 0
q 0 0 1
r 0 1 0
s 1 1 1
t 0 1 0
u 0 0 0
v 0 1 1
w 0 1 0
x 0 0 1
y 0 0 1
z 0 0 0

ComplexHeatmap documentation built on Nov. 14, 2020, 2:01 a.m.