title: How to iterate over file names in a R script?
body: <p>A very simple R script adds a ascending row index to a textfile "0.txt" and also adds a header "time" to it. After that the data is written to a file "0-edit.txt"</p>
  
  <pre><code>data&lt;-read.table("0.txt", header=TRUE,sep=",",row.names= NULL);
  colnames(data)[1] = "time"
  write.table(data,quote=FALSE,sep=", ","0-edit.txt");
  </code></pre>
  
  <p>Assume i have 4 files called 0.txt, 1.txt, 2.txt, ...in the same folder, how can I use a counter (or something else) to iterate over those file names in my script?</p>