Here is my take at extracting the different intersections together with the list of elements in them.
The main idea is to paste all the 0's and 1's from the binary table to create unique identifiers for each intersection and them use the dplyr::group_by function to extract the information
data <- data.frame(
entry = paste0("Entry.", 1:10),
"A" = c(0,0,0,0,1,0,1,1,0,0),
"B" = c(1,0,0,0,1,1,1,1,1,0),
"C" = c(1,1,1,1,0,0,1,0,1,1)
)
# NOT REQUIRED. Only to confirm that upset works with these data
upset(data)
You can then identify the intersections by pasting all the binary columns. I use the unite convenience function for this:
NB: you may have to change this depending on whether your data has row names or a column with names
data_with_intersection <- data %>%
unite(col = "intersection", -c("entry"), sep = "")
From here, you can easily calculate the size of each intersection:
# Table of intersections and the number of entries
data_with_intersection %>%
group_by(intersection) %>%
summarise(n = n()) %>%
arrange(desc(n))
Or even extract the list of entries/elements in each intersection:
# List of intersections and their entries
data_with_intersection %>%
group_by(intersection) %>%
summarise(list = list(entry)) %>%
mutate(list = setNames(list, intersection)) %>%
pull(list)
x <- upset(...)
it returns the data used for plotting. I couldn't easily see where the info you are after in that x object. – Mckinley