prepare_upset_data: Prepare data for Upset plot

View source: R/upsetplot.R

prepare_upset_dataR Documentation

Prepare data for Upset plot

Description

Prepare data for Upset plot

Usage

prepare_upset_data(
  data,
  in_form = "auto",
  group_by = NULL,
  group_by_sep = "_",
  id_by = NULL,
  specific = TRUE
)

Arguments

data

A data frame or a list or an UpsetPlotData object.

in_form

A character string indicating the datatype of the input data. Possible values are "long", "wide", "list", "upset" or "auto". "long" indicates the data is in long format. "wide" indicates the data is in wide format. "list" indicates the data is a list. "upset" indicates the data is a UpsetPlotData object. "auto" indicates the function will detect the datatype of the input data.

A long format data would look like:

group_by id_by
A        a1
A        a2
B        a1
B        a3
...

A wide format data would look like:

A    B
TRUE TRUE
TRUE FALSE
FALSE TRUE
...

A list format data would look like:

list(A = c("a1", "a2"), B = c("a1", "a3"))

An UpsetPlotData object is generated by prepare_update_data() would look like:

group_by
--------
list("A")  # a2
list("B")  # a3
list(c("A", "B"))  # a1
...
group_by

A character string specifying the column name of the data frame to group the data.

group_by_sep

A character string to concatenate the columns in group_by, if multiple columns are provided and the in_form is "long".

id_by

A character string specifying the column name of the data frame to identify the instances. Required when group_by is a single column and data is a data frame.

specific

A logical value to show the specific intersections only. ggVennDiagram, by default, only return the specific subsets of a region. However, sometimes, we want to show all the overlapping items for two or more sets. See https://github.com/gaospecial/ggVennDiagram/issues/64 for more details.

Value

A UpsetPlotData object


plotthis documentation built on June 8, 2025, 11:11 a.m.