title: Read a list of files, apply function and rewrite with same name
body: <p>I have a set of csv files with duplicate entries, which I needed to remove and rewrite the files with same name and format.</p>
  
  <p>Here is what I have done so far,</p>
  
  <pre><code>filenames&lt;-list.files(pattern =".csv") 
  datalist &lt;-lapply(filenames, function(x){read.csv(file=x,header=F)})
  unique.list &lt;- lapply(datalist,unique)
  </code></pre>
  
  <p>And I'm stuck with separating the data frames in the list and rewriting with same name. There is a more of a similar question, I tried hours but couldn't understand the proceedings.</p>