title: How to use loop to apply as.POSXIct to a column of multiple files
body: <p>This is a code i have been using so far to apply <code>as.POSIXct</code> for a <code>date_time</code> column of multiple files. If I can do this in a loop it would make my life much easier. The date and time are not formatted for any of the file, so the first step i have to do is to format the <code>date_time</code> column and then carry out other calculations for each files.
  This is the code I have been using so far.  </p>
  
  <pre><code>&gt; set(wd)
  &gt; files &lt;- list.files(pattern="*.csv")
  &gt; for(i in 1:length(files)) {
    assign(sprintf("a.%02d", i), read.csv(files[i], header=T))
    }
  &gt; a.01[,1] &lt;- as.POSIXct(a.01[,1], format="%m/%d/%Y %H:%S")
  &gt; a.02[,1] &lt;- as.POSIXct(a.02[,1], format="%m/%d/%Y %H:%S")
  &gt; a.03[,1] &lt;- as.POSIXct(a.03[,1], format="%m/%d/%Y %H:%S")
  &gt; a.04[,1] &lt;- as.POSIXct(a.04[,1], format="%m/%d/%Y %H:%S")
  &gt; a.05[,1] &lt;- as.POSIXct(a.05[,1], format="%m/%d/%Y %H:%S")
  &gt; a.06[,1] &lt;- as.POSIXct(a.06[,1], format="%m/%d/%Y %H:%S")
  ............................................................
  and so on. 
  </code></pre>
  
  <p>My sample data looks something like this. Each files consists of more than 3000 rows and multiple column. The following structure shows only the first 10 rows of one of the file, all other files are of same format. </p>
  
  <pre><code>&gt; dput(head(a.01, n=10))
  structure(list(date_time = structure(c(-61759604476, -61759593676, 
  -61759582876, -61759572076, -61759561276, -61759550476, -61759539676, 
  -61759528876, -61759518076, -61759507276), class = c("POSIXct", 
  "POSIXt"), tzone = ""), V1 = c(1002, 1002, 1002, 
  1001, 1000, 1001, 1001, 1002, 1003, 1004), V2 = c(2.228, 
  0.7123, 2.67, 4.378, 4.102, 3.782, 1.669, 1.356, 0.3223, 0.2053
  ), V3 = c(34.48, 8.455, 247.4, 259.8, 276, 333.7, 289.4, 
  324, 2.45, 306.9), V4 = c(32.23, 28.6, 31.04, 29.73, 35.24, 
  41.17, 37.49, 38.7, 40.8, 36.45), V5 = c(17.55, 
  18.55, 21.75, 23.65, 22.15, 19.65, 19.05, 17.25, 16.45, 17.35
  )), .Names = c("Date", "V1", "V2", "V3", 
  "V4", "V5"), row.names = c(NA, 10L), class = "data.frame")
  </code></pre>
  
  <p>The data looks something like this and all other files are of similar pattern with unformatted date and time. </p>
  
  <pre><code>&gt; head(a.01, n=5)
     date_time          V1     V2       V3       V4       V5
  1  12-12-01 00:00:00  1002   2.2280   34.480   32.23    17.55
  2  12-12-01 03:00:00  1002   0.7123   8.455    28.60    18.55
  3  12-12-01 06:00:00  1002   2.6700   247.400  31.04    21.75
  4  12-12-01 09:00:00  1001   4.3780   259.800  29.73    23.65
  5  12-12-01 12:00:00  1000   4.1020   276.000  35.24    22.15
  </code></pre>
  
  <p>Any suggestions are welcome. Thank you in advance. </p>