title: use an R script on all files in directory
body: <p>Hi I have the following R script</p>
  
  <pre><code>emboss&lt;-read.table("emboss_002.ss",header=T)
  x&lt;-table(emboss[,2],emboss[,3])/NROW(emboss[,3])
  y&lt;-as.vector(t(x))
  nms &lt;- expand.grid(colnames(x), rownames(x))
  names(y) &lt;- paste( nms[,2],nms[,1],sep="")
  write.table(t(y), file = "nontpsec.csv",append=TRUE)
  </code></pre>
  
  <p>where I have over 300 files called emboss_[i].ss</p>
  
  <p>How do I loop through the folder to run this script over every file? Each output goes into the same .csv file.</p>
  
  <p>By the way - here is my data frame (x)</p>
  
  <pre><code>x
  
                C           E           H
    A 0.057971014 0.017391304 0.026086957
    C 0.005797101 0.002898551 0.002898551
    D 0.046376812 0.000000000 0.002898551
    E 0.063768116 0.002898551 0.020289855
    F 0.011594203 0.005797101 0.005797101
    G 0.069565217 0.002898551 0.002898551
    H 0.028985507 0.000000000 0.000000000
    I 0.017391304 0.008695652 0.002898551
    K 0.014492754 0.002898551 0.002898551
    L 0.043478261 0.011594203 0.034782609
    M 0.005797101 0.002898551 0.002898551
    N 0.017391304 0.000000000 0.005797101
    P 0.055072464 0.000000000 0.000000000
    Q 0.046376812 0.002898551 0.008695652
    R 0.049275362 0.011594203 0.023188406
    S 0.043478261 0.005797101 0.002898551
    T 0.034782609 0.017391304 0.014492754
    V 0.037681159 0.014492754 0.008695652
    W 0.014492754 0.008695652 0.002898551
    Y 0.026086957 0.008695652 0.011594203
  </code></pre>
  
  <p>Thanks very much!</p>