text: user285: As i have multiple comparison so I m trying this UpSet plot, but it needs data to be formatted in particular way, one of the ways is as a list, so now the issue is since between one comparison the no of genes coming out may not be same as the other one, so there is a difference in dimension so if i bind them as data frame then i get dimension error, so the best way to get through is make list so what i have tried so far 
  A <- read.csv("GMP_MONO_UP_DOWN_CDS_EPI.txt",header = TRUE)
  B <- read.csv("CMP_GMP_UP_DOWN_EPI.txt",header = TRUE)
  C <- read.csv("HSC_BLAST_UPDOWN_EPI.txt",header = TRUE,sep = '\t')
  
  dim(A)
  dim(B)
  ONE <- A[c(1)]#############just taking out the gene column########
  TWO <- B[c(1)]#############just taking out the gene column########
  THREE <- B[c(1)]#############just taking out the gene column########
  dim(ONE)
  dim(TWO)
  b1 <- apply(ONE,2,list) 
  b2 <- apply(TWO,2,list)
  
  Now this is the code from their help page 
  upset(movies, nsets = 7, nintersects = 30, mb.ratio = c(0.5, 0.5),
        order.by = c("freq", "degree"), decreasing = c(TRUE,FALSE))
  
  so the data "movies" class is data frame, there is not dimension issue as such as in my case if i want to intersect two comparison which may not have the same length, so how do i overcome the issue any suggestion or help would be highly appreciated. Update my question with one more data to add.
  
  user48: You need to set a common number of rows, one for each gene (make sure that the gene identifiers are the same for both files). Then in the first column you can set 1 for the file A, and 0 otherwise. In the second column you can do the same.
  Then you add this dataframe as the input of the upset function.
  genes <- unique(c(ONE, TWO))
  df <- data.frame(A = ifelse(genes %in% A, 1, 0), B = ifelse(genes %in% b, 1, 0))
  upset(df, ...)
  
  
  user581: Don't you just need a binary matrix with presence/absence data for all of the genes?
  library(dplyr)
  combined <- full_join(data.frame(gene=ONE, GMP_MONO=1),
                        data.frame(gene=TWO, CMP=1))
  combined[is.na(combined)] <- 0
  
  Edit:
  To loop over a large number of data frames, the easiest solution is to use the reduce function from the purrr package:
  combined <- reduce(list(data.frame(gene=c('gene1', 'gene2', 'gene3'), set1=1),
                          data.frame(gene=c('gene3', 'gene4', 'gene5'), set2=1),
                          data.frame(gene=c('gene1', 'gene4'), set3=1)
                         ), full_join)
  combined[is.na(combined)] <- 0
  combined
  #    gene set1 set2 set3
  # 1 gene1    1    0    1
  # 2 gene2    1    0    0
  # 3 gene3    1    1    0
  # 4 gene4    0    1    1
  # 5 gene5    0    1    0
  
  
  user131: We can plot using lists as well, using fromList function, see example:
  library(UpSetR)
  
  myGeneSets <- 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
  
  
original_text: 285: <p>As i have multiple comparison so I m trying this <code>UpSet</code> plot, but it needs data to be formatted in particular way, one of the ways is as a list, so now the issue is since between one comparison the no of genes coming out may not be same as the other one, so there is a difference in dimension so if i bind them as data frame then i get dimension error, so the best way to get through is make list so what i have tried so far </p>
  
  <pre><code>A &lt;- read.csv("GMP_MONO_UP_DOWN_CDS_EPI.txt",header = TRUE)
  B &lt;- read.csv("CMP_GMP_UP_DOWN_EPI.txt",header = TRUE)
  C &lt;- read.csv("HSC_BLAST_UPDOWN_EPI.txt",header = TRUE,sep = '\t')
  
  dim(A)
  dim(B)
  ONE &lt;- A[c(1)]#############just taking out the gene column########
  TWO &lt;- B[c(1)]#############just taking out the gene column########
  THREE &lt;- B[c(1)]#############just taking out the gene column########
  dim(ONE)
  dim(TWO)
  b1 &lt;- apply(ONE,2,list) 
  b2 &lt;- apply(TWO,2,list)
  </code></pre>
  
  <p>Now this is the code from their help page </p>
  
  <pre><code>upset(movies, nsets = 7, nintersects = 30, mb.ratio = c(0.5, 0.5),
        order.by = c("freq", "degree"), decreasing = c(TRUE,FALSE))
  </code></pre>
  
  <p>so the data "movies" class is data frame, there is not dimension issue as such as in my case if i want to intersect two comparison which may not have the same length, so how do i overcome the issue any suggestion or help would be highly appreciated. Update my question with one more data to add.</p>
   48: <p>You need to set a common number of rows, one for each gene (make sure that the gene identifiers are the same for both files). Then in the first column you can set 1 for the file A, and 0 otherwise. In the second column you can do the same.
  Then you add this dataframe as the input of the <code>upset</code> function.</p>
  
  <pre><code>genes &lt;- unique(c(ONE, TWO))
  df &lt;- data.frame(A = ifelse(genes %in% A, 1, 0), B = ifelse(genes %in% b, 1, 0))
  upset(df, ...)
  </code></pre>
   581: <p>Don't you just need a binary matrix with presence/absence data for all of the genes?</p>
  
  <pre><code>library(dplyr)
  combined &lt;- full_join(data.frame(gene=ONE, GMP_MONO=1),
                        data.frame(gene=TWO, CMP=1))
  combined[is.na(combined)] &lt;- 0
  </code></pre>
  
  <p>Edit:
  To loop over a large number of data frames, the easiest solution is to use the <code>reduce</code> function from the <a href="https://github.com/tidyverse/purrr" rel="nofollow noreferrer">purrr</a> package:</p>
  
  <pre><code>combined &lt;- reduce(list(data.frame(gene=c('gene1', 'gene2', 'gene3'), set1=1),
                          data.frame(gene=c('gene3', 'gene4', 'gene5'), set2=1),
                          data.frame(gene=c('gene1', 'gene4'), set3=1)
                         ), full_join)
  combined[is.na(combined)] &lt;- 0
  combined
  #    gene set1 set2 set3
  # 1 gene1    1    0    1
  # 2 gene2    1    0    0
  # 3 gene3    1    1    0
  # 4 gene4    0    1    1
  # 5 gene5    0    1    0
  </code></pre>
   131: <p>We can plot using lists as well, using <code>fromList</code> function, see example:</p>
  
  <pre><code>library(UpSetR)
  
  myGeneSets &lt;- list(
    set1 = c("gene1","gene2","gene3"),
    set2 = c("gene1","gene4","gene5", "gene7"),
    set3 = c("gene1","gene7")
    )
  
  upset(fromList(myGeneSets))
  </code></pre>
  
  <blockquote>
    <p><strong>fromList</strong></p>
    
    <p>A function to convert a list of named vectors to a data frame
    compatible with UpSetR.</p>
  </blockquote>
  
  <pre><code>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
  </code></pre>
  