title: how to export the results into different tabs of excel in R
body: <p>I have multiple data frames that I would like to export into different tabs of an excel/csv file. I'll be grouping my 15 data frames into three groups of five. This way I would have three excel sheets with five different tabs instead of 15 individual excel sheet. </p>
  
  <p>To export to excel:</p>
  
  <pre><code>#fake data 
  data_1&lt;-data.frame(c(03,23,4,2))
  data_2&lt;-data.frame(c(0223,3,1,2))
  data_3&lt;-data.frame(c(0232,3,1,1))
  data_4&lt;-data.frame(c(21,23,5,6))
  data_5&lt;-data.frame(c(24,5,6,7))
  
  #fake names
  mydatasets&lt;-c(data_1,data_2,data_3,data_4,data_5)
  mytitles&lt;-c("data1", "data2", "data3","data4", "data5")
  
  
  #for loop to write out individual csv files
  for (i in 1:5)) {
  a &lt;- mydatasets[i]
  title&lt;-mytitles[i]
  myfile &lt;- paste0(title, "_", ".csv")
  write.csv(a, file = myfile)
                 }
  </code></pre>
  
  <p>How do I get the  above code to merge those csv files into multiple tabs of one csv file or excel file?</p>