title: applying same function on multiple files in R
body: <p>I am new to R program and currently working on a set of financial data. Now I got around 10 csv files under my working directory and I want to analyze one of them and apply the same command to the rest of csv files. </p>
  
  <p>Here are all the names of these files: ("US%10y.csv", "UK%10y.csv", "GER%10y.csv","JAP%10y.csv", "CHI%10y.csv", "SWI%10y.csv","SOA%10y.csv", "BRA%10y.csv", "CAN%10y.csv", "AUS%10y.csv")</p>
  
  <p>For example, because the Date column in CSV files are Factor so I need to change them to Date format:</p>
  
  <pre><code>CAN &lt;- read.csv("CAN%10y.csv", header = T, sep = ",")
  CAN$Date &lt;- as.character(CAN$Date)
  CAN$Date &lt;- as.Date(CAN$Date, format ="%m/%d/%y")
  CAN_merge &lt;- merge(all.dates.frame, CAN, all = T)
  CAN_merge$Bid.Yield.To.Maturity &lt;- NULL
  </code></pre>
  
  <p>all.dates.frame is a data frame of 731 consecutive days. I want to merge them so that each file will have the same number of rows which later enables me to combine 10 files together to get a 731 X 11 master data frame. </p>
  
  <p>Surely I can copy and paste this code and change the file name, but is there any simple approach to use apply or for loop to do that ??? </p>
  
  <p>Thank you very much for your help. </p>