title: Calculate readability scores for several files with R
body: <p>I would like to calculate the readability scores in R-3.3.2(R-Studio 3.4 for Win) using koRpus package for several txt.files and save results to excel or sqllite3 or txt.
  Now I can only calculate the readability score for one file only and print them to console. I tried to improve the code using loop over directory but it fails to work correctly.</p>
  
  <pre><code>library(koRpus)
  library(tm)
  
  #Loop through files
  path = "D://Reports"
  out.file&lt;-""
  file.names &lt;- dir(path, pattern =".txt")
  for(i in 1:length(file.names)){
    file &lt;- read.table(file.names[i],header=TRUE, sep=";", stringsAsFactors=FALSE)
    out.file &lt;- rbind(out.file, file)
  }
  
  #Only one file
  report &lt;- tokenize(txt =file , format = "file", lang = "en")
  
  #SMOG-Index
  results_smog &lt;- SMOG(report)
  summary(results_smog)
  
  #Flesch/Kincaid-Index
  results_fleshkin &lt;- flesch.kincaid(report)
  summary(results_fleshkin)
  
  #FOG-Index
  results_fog&lt;- FOG(report)
  summary(results_fog)
  </code></pre>