text: user285: I have to intersect multiple data frame to find common elements. For visualization purpose i can use upset Plot but it doesn;t return a object containing the intersection object .I tried jvenn but at max it can take six sets to intersect .
  Im able to do the interesction but i would like to know if i can do it more efficiently ,which apparently not sure how to do this is my code as of now where i read each file as data frame, covert them to list and pass them to do intersection .
  NewList <- split(GO0000122, f = seq(nrow(GO0000122)))
  NewList1 <- split(GO0006351,f=seq(nrow(GO0006351)))
  NewList2 <- split(GO0006355,f=seq(nrow(GO0006355)))
  NewList3 <- split(GO0006357,f=seq(nrow(GO0006357)))
  NewList4 <- split(GO0006366,f=seq(nrow(GO0006366)))
  NewList5 <- split(GO0030154,f=seq(nrow(GO0030154)))
  NewList6 <- split(GO0045892,f=seq(nrow(GO0045892)))
  NewList8 <- split(GO0045893,f=seq(nrow(GO0045893)))
  NewList7 <- split(GO0045944,f=seq(nrow(GO0045944)))
  
  a <- intersect_all(NewList,NewList1,NewList2,NewList3,NewList4,NewList5,NewList6,NewList7,NewList8)
  
  
  b <- do.call(rbind.data.frame, a)
  
  Can i read the files and pass them into list and do the same that would help me from doing lot of things manually 
  I can read the files from the directory where i have my files but not sure how to pass them to make it as list.
  filenames <- gsub("\\.csv$","", list.files(pattern="\\.csv$"))
  for(i in filenames){
    assign(i, read.csv(paste(i, ".csv", sep="")))
  }
  
  The object filenames is character here .It just returns me list of files.
  So how to make my question bit more clear , i would like to read the list of file from the directory and then pass these to perform intersection. Any suggestion or help would be really appreciated .
  
  user4001: Change dataframe to load all the files into a list:
  wd <- "C:/all_your_dataframes_in_one_folder"
  setwd(wd)
  Then you get the list of files you want from your folder
  files <- list.files()
  Put into a list with a loop
  dflist <- list()
  for(i in 1:length(files)){
   dflist[[i]] <- read.csv(files[i])
  }
  
  Then use tidyverse solution 
  library(tidyverse)
  map(dflist, ~.$GeneID) %>% #creates a list just of the column of interest
      reduce(intersect)  #applies the intersect function cumulatively to the list
  
  
original_text: 285: <p>I have to intersect multiple data frame to find common elements. For visualization purpose i can use upset Plot but it doesn;t return a object containing the intersection object .I tried jvenn but at max it can take six sets to intersect .</p>
  
  <p>Im able to do the interesction but i would like to know if i can do it more efficiently ,which apparently not sure how to do this is my code as of now where i read each file as data frame, covert them to list and pass them to do intersection .</p>
  
  <pre><code>NewList &lt;- split(GO0000122, f = seq(nrow(GO0000122)))
  NewList1 &lt;- split(GO0006351,f=seq(nrow(GO0006351)))
  NewList2 &lt;- split(GO0006355,f=seq(nrow(GO0006355)))
  NewList3 &lt;- split(GO0006357,f=seq(nrow(GO0006357)))
  NewList4 &lt;- split(GO0006366,f=seq(nrow(GO0006366)))
  NewList5 &lt;- split(GO0030154,f=seq(nrow(GO0030154)))
  NewList6 &lt;- split(GO0045892,f=seq(nrow(GO0045892)))
  NewList8 &lt;- split(GO0045893,f=seq(nrow(GO0045893)))
  NewList7 &lt;- split(GO0045944,f=seq(nrow(GO0045944)))
  
  a &lt;- intersect_all(NewList,NewList1,NewList2,NewList3,NewList4,NewList5,NewList6,NewList7,NewList8)
  
  
  b &lt;- do.call(rbind.data.frame, a)
  </code></pre>
  
  <p>Can i read the files and pass them into list and do the same that would help me from doing lot of things manually </p>
  
  <p>I can read the files from the directory where i have my files but not sure how to pass them to make it as list.</p>
  
  <pre><code>filenames &lt;- gsub("\\.csv<span class="math-container">$","", list.files(pattern="\\.csv$</span>"))
  for(i in filenames){
    assign(i, read.csv(paste(i, ".csv", sep="")))
  }
  </code></pre>
  
  <p>The object filenames is <code>character</code> here .It just returns me list of files.</p>
  
  <p>So how to make my question bit more clear , i would like to read the list of file from the directory and then pass these to perform intersection. Any suggestion or help would be really appreciated .</p>
   4001: <p>Change dataframe to load all the files into a list:</p>
  
  <p><code>wd &lt;- "C:/all_your_dataframes_in_one_folder"</code></p>
  
  <p><code>setwd(wd)</code></p>
  
  <p>Then you get the list of files you want from your folder</p>
  
  <p><code>files &lt;- list.files()</code></p>
  
  <p>Put into a list with a loop</p>
  
  <pre><code>dflist &lt;- list()
  for(i in 1:length(files)){
   dflist[[i]] &lt;- read.csv(files[i])
  }
  </code></pre>
  
  <p>Then use tidyverse solution </p>
  
  <p><code>library(tidyverse)</code></p>
  
  <pre><code>map(dflist, ~.$GeneID) %&gt;% #creates a list just of the column of interest
      reduce(intersect)  #applies the intersect function cumulatively to the list
  </code></pre>
  