Answers.Body: <p>You can use For Loop here. Here I have created code using your algorithm, first created a list of merged dataframes and then split the list into separate dataframes.</p>
  <pre><code>S1 &lt;- data.frame(values = c (1:5), numbers = c(11:15))
  S2 &lt;- data.frame(values = c (1:5), numbers = c(11:15))
  S3 &lt;- data.frame(values = c (1:5), numbers = c(16:20))
  #Dataframe X
  X &lt;- data.frame(values = c (26:30), numbers = c(501:505))
  
  #defining a NULL object
  S=NULL
  #creating a list of merged dataframes
  for (i in 1:3){
  S[i] = list(rbind(get(paste(&quot;S&quot;,i,sep='')),X))
  names(S)[i] = paste(&quot;S&quot;,i,&quot;_X&quot;,sep='')}
  
  #extracting dataframes
  for(i in 1:3){
  assign(paste(&quot;S&quot;,i,&quot;_X&quot;,sep = &quot;&quot;),S[[i]])
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-21T08:49:18.753Z
Answers.LastActivityDate: 2022-09-21T08:49:18.753Z
Answers.UserDisplayName: Nitesh Shriwash
Body: <p>Let us say that we have some data frames named S1,S2,S3... that I want to join independently by column names to dataframe X. This is how they look like:</p>
  <pre><code>S1 &lt;- data.frame(
    values = c (1:5), 
    numbers = c(11:15))
  S1
  
  
  S2 &lt;- data.frame(
    values = c (1:5), 
    numbers = c(11:15))
  S2
  
  
  S3 &lt;- data.frame(
    values = c (1:5), 
    numbers = c(16:20))
  S3
  </code></pre>
  <p>#Dataframe X</p>
  <pre><code>X &lt;- data.frame(
    values = c (26:30), 
    numbers = c(501:505))
  X
  
  S1
  S2
  S3
  X
  </code></pre>
  <p>Using rbind, it is really easy to merge/join them according to column names. As below:</p>
  <pre><code>S1_X&lt;- rbind(S1,X)
  
  S1_X
  
  
  S2_X&lt;- rbind(S2,X)
  
  S2_X
  
  
  S3_X&lt;- rbind(S3,X)
  
  S3_X
  </code></pre>
  <p>Now the problem is that I have 500 plus data frames (S1,S2,S3,S4,S5.....S500) that I want to join to dataframe &quot;X&quot; by any function. For example rbind. Is it possible to use some loop/function for that.</p>
  <p>What I have best tried is create a list (nested list of dataframes) that I can later split into individual dataframes:</p>
  <pre><code>output = lapply(list(S1=S1,S2=S2,S3=S3),rbind,X)
  </code></pre>
  <p>The output is what I expected. So it works The only problem is, how do I specify S1 to S500?</p>
  <p>Thank you in advance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-14T12:23:42.323Z
Comments.Text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comments.UserDisplayName: Community
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-14T12:49:02.607Z
Comments.Text: Hi, I did specify that I have 500 data frames named S1,S2,S3,S4.....S500 that I want to join to data frame X which is a dataframe too. If you will run the codes above you will find out that I tried to make it simple. Thank you!
Comments.UserDisplayName: salman1490
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-14T15:03:58.140Z
Comments.Text: @salman1490 I would recommend deleting this question here and reposting on Stack Overflow. It's not really as bioinformatics question and you'll get a much quicker response there.
Comments.UserDisplayName: user438383
Tags: <r><dataframe>
Title: Merge/Join one data frame (X) to multiple data frames separately
ThreadText: # Merge/Join one data frame (X) to multiple data frames separately
  
  (Asked by: username_0 on 2022-09-14)
  
  Let us say that we have some data frames named S1,S2,S3... that I want to join independently by column names to dataframe X. This is how they look like:
  
  ```
  S1 <- data.frame(
    values = c (1:5), 
    numbers = c(11:15))
  S1
  
  S2 <- data.frame(
    values = c (1:5), 
    numbers = c(11:15))
  S2
  
  S3 <- data.frame(
    values = c (1:5), 
    numbers = c(16:20))
  S3
  
  ```
  
  #Dataframe X
  
  ```
  X <- data.frame(
    values = c (26:30), 
    numbers = c(501:505))
  X
  
  S1
  S2
  S3
  X
  
  ```
  
  Using rbind, it is really easy to merge/join them according to column names. As below:
  
  ```
  S1_X<- rbind(S1,X)
  
  S1_X
  
  S2_X<- rbind(S2,X)
  
  S2_X
  
  S3_X<- rbind(S3,X)
  
  S3_X
  
  ```
  
  Now the problem is that I have 500 plus data frames (S1,S2,S3,S4,S5.....S500) that I want to join to dataframe "X" by any function. For example rbind. Is it possible to use some loop/function for that.
  
  What I have best tried is create a list (nested list of dataframes) that I can later split into individual dataframes:
  
  ```
  output = lapply(list(S1=S1,S2=S2,S3=S3),rbind,X)
  
  ```
  
  The output is what I expected. So it works The only problem is, how do I specify S1 to S500?
  
  Thank you in advance!
  
  **Tags:** r, dataframe
  
  > **Comments:**
  > **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
  > **username_0**: Hi, I did specify that I have 500 data frames named S1,S2,S3,S4.....S500 that I want to join to data frame X which is a dataframe too. If you will run the codes above you will find out that I tried to make it simple. Thank you!  
  > **username_2**: @username_0 I would recommend deleting this question here and reposting on Stack Overflow. It's not really as bioinformatics question and you'll get a much quicker response there.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2022-09-21. Score: 1
  
  You can use For Loop here. Here I have created code using your algorithm, first created a list of merged dataframes and then split the list into separate dataframes.
  
  ```
  S1 <- data.frame(values = c (1:5), numbers = c(11:15))
  S2 <- data.frame(values = c (1:5), numbers = c(11:15))
  S3 <- data.frame(values = c (1:5), numbers = c(16:20))
  #Dataframe X
  X <- data.frame(values = c (26:30), numbers = c(501:505))
  
  #defining a NULL object
  S=NULL
  #creating a list of merged dataframes
  for (i in 1:3){
  S[i] = list(rbind(get(paste("S",i,sep='')),X))
  names(S)[i] = paste("S",i,"_X",sep='')}
  
  #extracting dataframes
  for(i in 1:3){
  assign(paste("S",i,"_X",sep = ""),S[[i]])
  }
  
  ```
  
  
  ---
  
  