title: For loop that creates one combined data frame in R
body: <p>I am trying to create data frames from a series of different files that I then want to comebine into one large data frame. Here is a simplified version of the for loop I have:</p>
  
  <pre><code>files&lt;-list.files("filelocation",full.names = T)
  
  data&lt;-data.frame(matrix(ncol=5,nrow=0))
  x&lt;-c("A","B","C","D","E")
  colnames(data) &lt;- x
  
  for (file in files) {
  data2&lt;-read.csv(file)
  data3&lt;-data2[-c(1:2),]
  data3$A&lt;-data3$A/10000
  dataMerge&lt;- merge(data,data3,by= ("A","B","C","D","E")), all=T)
  dataMerge2&lt;-dataMerge[order(dataMerge$B),]
  print(dataMerge2)
  }
  </code></pre>
  
  <p>This will print out the results for all the different files in my console but it doesn't create one combined data frame, only the data frame for one of the files. What do I need to add to create this combined date frame?</p>