Preparing data for UpSet Plot in R
We can plot using lists as well, using fromList function, see example:

library(UpSetR)

myGeneSets &lt;- list(
  set1 = c("gene1","gene2","gene3"),
  set2 = c("gene1","gene4","gene5", "gene7"),
  set3 = c("gene1","gene7")
  )

upset(fromList(myGeneSets))



  fromList
  
  A function to convert a list of named vectors to a data frame
  compatible with UpSetR.


fromList(myGeneSets)
#   set1 set2 set3
# 1    1    1    1
# 2    1    0    0
# 3    1    0    0
# 4    0    1    0
# 5    0    1    0
# 6    0    1    1