Comment: C: Applying a task to several files in R - https://www.biostars.org/p...
I'm closing this up, since it's not a bioinformatics question, as noted below. This allow us to keep the site focused on the topics that the community can help with.  Please consider asking your question on Stack Overflow, or better yet, taking a little time to work through a basic R tutorial, which will help with both of the questions you've asked today. - Chris Miller